Struct stun_types::attribute::Userhash
source · 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<'a> From<&'a Userhash> for RawAttribute<'a>
impl<'a> From<&'a Userhash> for RawAttribute<'a>
source§fn from(value: &'a Userhash) -> RawAttribute<'a>
fn from(value: &'a Userhash) -> RawAttribute<'a>
Converts to this type from the input type.
source§impl PartialEq for Userhash
impl PartialEq for Userhash
source§impl<'a> TryFrom<&RawAttribute<'a>> for Userhash
impl<'a> TryFrom<&RawAttribute<'a>> for Userhash
§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<E, T> AttributeFromRaw<E> for T
impl<E, T> AttributeFromRaw<E> for T
source§fn from_raw(raw: &RawAttribute<'_>) -> Result<T, E>
fn from_raw(raw: &RawAttribute<'_>) -> Result<T, E>
Convert an
Attribute from a RawAttributesource§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)