Struct stun_rs::attributes::AttributeType
source · [−]pub struct AttributeType(_);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
sourceimpl 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
sourceimpl Clone for AttributeType
impl Clone for AttributeType
sourcefn clone(&self) -> AttributeType
fn clone(&self) -> AttributeType
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresourceimpl Debug for AttributeType
impl Debug for AttributeType
sourceimpl Display for AttributeType
impl Display for AttributeType
sourceimpl From<AttributeType> for u16
impl From<AttributeType> for u16
sourcefn from(val: AttributeType) -> Self
fn from(val: AttributeType) -> Self
Converts to this type from the input type.
sourceimpl From<u16> for AttributeType
impl From<u16> for AttributeType
sourceimpl Hash for AttributeType
impl Hash for AttributeType
sourceimpl Ord for AttributeType
impl Ord for AttributeType
sourcefn cmp(&self, other: &AttributeType) -> Ordering
fn cmp(&self, other: &AttributeType) -> Ordering
1.21.0 · sourcefn 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
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<AttributeType> for AttributeType
impl PartialEq<AttributeType> for AttributeType
sourcefn eq(&self, other: &AttributeType) -> bool
fn eq(&self, other: &AttributeType) -> bool
sourceimpl PartialOrd<AttributeType> for AttributeType
impl PartialOrd<AttributeType> for AttributeType
sourcefn partial_cmp(&self, other: &AttributeType) -> Option<Ordering>
fn partial_cmp(&self, other: &AttributeType) -> Option<Ordering>
1.0.0 · sourcefn 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 StructuralEq for AttributeType
impl StructuralPartialEq for AttributeType
Auto Trait Implementations
impl RefUnwindSafe for AttributeType
impl Send for AttributeType
impl Sync for AttributeType
impl Unpin for AttributeType
impl UnwindSafe for AttributeType
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more