pub struct AttributeType(/* private fields */);
Expand description
A STUN attribute type is a hex number in the range 0x0000-0xFFFF. STUN attribute types in the range 0x0000-0x7FFF are considered comprehension-required.
§Examples
let attr_type = AttributeType::from(0x0008);
assert_eq!(attr_type.as_u16(), 0x0008);
// This is a comprehension required attribute
assert!(attr_type.is_comprehension_required());
// This is not a comprehension optional attribute
assert!(!attr_type.is_comprehension_optional());
Implementations§
source§impl AttributeType
impl AttributeType
sourcepub fn new(attr_type: u16) -> Self
pub fn new(attr_type: u16) -> Self
Creates a new AttributeType
sourcepub fn is_comprehension_required(&self) -> bool
pub fn is_comprehension_required(&self) -> bool
Returns true if this is a comprehension required attribute
sourcepub fn is_comprehension_optional(self) -> bool
pub fn is_comprehension_optional(self) -> bool
Returns true if this is a comprehension optional attribute
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(val: AttributeType) -> Self
fn from(val: AttributeType) -> Self
Converts to this type from the input type.
source§impl From<u16> for AttributeType
impl From<u16> for AttributeType
source§impl Hash for AttributeType
impl Hash 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§impl PartialOrd for AttributeType
impl PartialOrd for AttributeType
impl 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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
)