Struct torrust_index_backend::models::info_hash::InfoHash
source · pub struct InfoHash(pub [u8; 20]);
Expand description
BitTorrent
Info Hash v1
Tuple Fields§
§0: [u8; 20]
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 Ord for InfoHash
impl Ord for InfoHash
source§impl PartialEq<InfoHash> for InfoHash
impl PartialEq<InfoHash> for InfoHash
source§impl PartialOrd<InfoHash> for InfoHash
impl PartialOrd<InfoHash> for InfoHash
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for InfoHash
impl Eq for InfoHash
impl StructuralEq for InfoHash
impl StructuralPartialEq for InfoHash
Auto Trait Implementations§
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<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.