pub struct InfoHash { /* private fields */ }Expand description
BitTorrent Info Hash v1
Implementations§
Source§impl InfoHash
impl InfoHash
Sourcepub fn from_bytes(bytes: &[u8]) -> Self
pub fn from_bytes(bytes: &[u8]) -> Self
Create a new InfoHash from a byte slice.
§Panics
Will panic if byte slice does not contains the exact amount of bytes need for the InfoHash.
Sourcepub fn to_hex_string(&self) -> String
pub fn to_hex_string(&self) -> String
Returns the InfoHash as a hex string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for InfoHash
impl<'de> Deserialize<'de> for InfoHash
Source§fn deserialize<D: Deserializer<'de>>(des: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(des: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&DefaultHasher> for InfoHash
for testing
impl From<&DefaultHasher> for InfoHash
for testing
Source§fn from(data: &DefaultHasher) -> InfoHash
fn from(data: &DefaultHasher) -> InfoHash
Converts to this type from the input type.
Source§impl Ord for InfoHash
impl Ord for InfoHash
Source§impl PartialOrd for InfoHash
impl PartialOrd for InfoHash
impl Copy for InfoHash
impl Eq for InfoHash
impl StructuralPartialEq for InfoHash
Auto Trait Implementations§
impl Freeze for InfoHash
impl RefUnwindSafe for InfoHash
impl Send for InfoHash
impl Sync for InfoHash
impl Unpin for InfoHash
impl UnwindSafe for InfoHash
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more