Struct librice::stun::attribute::AttributeType
source · pub struct AttributeType(_);
Implementations§
source§impl AttributeType
impl AttributeType
sourcepub fn new(val: u16) -> Self
pub 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!(XOR_MAPPED_ADDRESS.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 < 0x800 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<AttributeType> for AttributeType
impl PartialEq<AttributeType> 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<AttributeType> for AttributeType
impl PartialOrd<AttributeType> 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 more