Struct stun_types::attribute::AttributeType
source · pub struct AttributeType(/* private fields */);Implementations§
source§impl AttributeType
impl AttributeType
sourcepub const fn new(val: u16) -> Self
pub const fn new(val: u16) -> Self
Create a new AttributeType from an existing value
Note: the value passed in is not encoded as in a stun message
§Examples
assert_eq!(AttributeType::new(0x123).value(), 0x123);sourcepub fn value(&self) -> u16
pub fn value(&self) -> u16
Return the integer value of this AttributeType
Note: the value returned is not encoded as in a stun message
§Examples
assert_eq!(AttributeType::new(0x123).value(), 0x123);sourcepub fn name(self) -> &'static str
pub fn name(self) -> &'static str
Returns a human readable name of this AttributeType or “unknown”
§Examples
assert_eq!(XorMappedAddress::TYPE.name(), "XOR-MAPPED-ADDRESS");sourcepub fn comprehension_required(self) -> bool
pub fn comprehension_required(self) -> bool
Check if comprehension is required for an AttributeType. All integer attribute
values < 0x8000 require comprehension.
§Examples
assert_eq!(AttributeType::new(0x0).comprehension_required(), true);
assert_eq!(AttributeType::new(0x8000).comprehension_required(), false);Trait Implementations§
source§impl Clone for AttributeType
impl Clone for AttributeType
source§fn clone(&self) -> AttributeType
fn clone(&self) -> AttributeType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for AttributeType
impl Debug for AttributeType
source§impl Display for AttributeType
impl Display for AttributeType
source§impl From<AttributeType> for u16
impl From<AttributeType> for u16
source§fn from(f: AttributeType) -> Self
fn from(f: AttributeType) -> Self
Converts to this type from the input type.
source§impl From<u16> for AttributeType
impl From<u16> for AttributeType
source§impl Ord for AttributeType
impl Ord for AttributeType
source§fn cmp(&self, other: &AttributeType) -> Ordering
fn cmp(&self, other: &AttributeType) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for AttributeType
impl PartialEq for AttributeType
source§fn eq(&self, other: &AttributeType) -> bool
fn eq(&self, other: &AttributeType) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PartialOrd for AttributeType
impl PartialOrd for AttributeType
source§fn partial_cmp(&self, other: &AttributeType) -> Option<Ordering>
fn partial_cmp(&self, other: &AttributeType) -> Option<Ordering>
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 AttributeType
impl Eq for AttributeType
impl StructuralPartialEq for AttributeType
Auto Trait Implementations§
impl Freeze for AttributeType
impl RefUnwindSafe for AttributeType
impl Send for AttributeType
impl Sync for AttributeType
impl Unpin for AttributeType
impl UnwindSafe for AttributeType
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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)