pub struct Userhash { /* private fields */ }Expand description
The Userhash Attribute
Implementations§
Source§impl Userhash
impl Userhash
Sourcepub fn hash(&self) -> &[u8; 32]
pub fn hash(&self) -> &[u8; 32]
Retrieve the hash value
§Examples
let value = [0;32];
let user = Userhash::new(value);
assert_eq!(user.hash(), &value);Sourcepub fn compute(user: &str, realm: &str) -> [u8; 32]
pub fn compute(user: &str, realm: &str) -> [u8; 32]
Compute the hash of a specified block of data as required by STUN
§Examples
assert_eq!(Userhash::compute("user", "realm"), [106, 48, 41, 17, 107, 71, 170, 152, 188, 170, 50, 83, 153, 115, 61, 193, 162, 60, 213, 126, 38, 184, 27, 239, 63, 246, 83, 28, 230, 36, 226, 218]);Trait Implementations§
Source§impl AttributeFromRaw<'_> for Userhash
impl AttributeFromRaw<'_> for Userhash
Source§fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
Produce an
Attribute from a RawAttributeSource§fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
Produce an
Attribute from a RawAttributeSource§impl AttributeStaticType for Userhash
impl AttributeStaticType for Userhash
Source§const TYPE: AttributeType
const TYPE: AttributeType
The
AttributeTypeSource§impl AttributeWrite for Userhash
impl AttributeWrite for Userhash
Source§fn to_raw(&self) -> RawAttribute<'_>
fn to_raw(&self) -> RawAttribute<'_>
Produce a
RawAttribute from this AttributeSource§fn write_into_unchecked(&self, dest: &mut [u8])
fn write_into_unchecked(&self, dest: &mut [u8])
Write attribute to the provided destination buffer. Read more
Source§impl TryFrom<&RawAttribute<'_>> for Userhash
impl TryFrom<&RawAttribute<'_>> for Userhash
Source§type Error = StunParseError
type Error = StunParseError
The type returned in the event of a conversion error.
impl Eq for Userhash
impl StructuralPartialEq for Userhash
Auto Trait Implementations§
impl Freeze for Userhash
impl RefUnwindSafe for Userhash
impl Send for Userhash
impl Sync for Userhash
impl Unpin for Userhash
impl UnwindSafe for Userhash
Blanket Implementations§
Source§impl<A> AttributeExt for A
impl<A> AttributeExt for A
Source§impl<A> AttributeWriteExt for Awhere
A: AttributeWrite + ?Sized,
impl<A> AttributeWriteExt for Awhere
A: AttributeWrite + ?Sized,
Source§fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
Write the 4 byte attribute header into the provided destination buffer returning the
number of bytes written, or an error.
Source§fn write_header_unchecked(&self, dest: &mut [u8]) -> usize
fn write_header_unchecked(&self, dest: &mut [u8]) -> usize
Write the 4 byte attribute header into the provided destination buffer returning the
number of bytes written. Read more
Source§fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
Write this attribute into the provided destination buffer returning the number of bytes
written, or an error.
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