intermodal/src/into_u64.rs
Annie Cherkaev f1514dd301
Add support for BEP 39.
Add update-url field to info struct.

See BEP 39 for more details:
http://bittorrent.org/beps/bep_0039.html

type: added
fixes:
- https://github.com/casey/intermodal/issues/98
2020-04-27 17:47:40 -07:00

18 lines
447 B
Rust

use crate::common::*;
// Systems with pointers larger than 64 bits may eventually exist, but
// for now let's assume that usize is at most 64 bits, and document that
// assumption with this assert.
const_assert!(std::mem::size_of::<usize>() <= std::mem::size_of::<u64>());
pub(crate) trait IntoU64 {
fn into_u64(self) -> u64;
}
impl IntoU64 for usize {
fn into_u64(self) -> u64 {
#![allow(clippy::as_conversions)]
self as u64
}
}