pub enum StunAttribute {
Show 16 variants Unknown(Unknown), AlternateServer(AlternateServer), ErrorCode(ErrorCode), Fingerprint(Fingerprint), MappedAddress(MappedAddress), MessageIntegrity(MessageIntegrity), MessageIntegritySha256(MessageIntegritySha256), Nonce(Nonce), PasswordAlgorithm(PasswordAlgorithm), PasswordAlgorithms(PasswordAlgorithms), Realm(Realm), Software(Software), UnknownAttributes(UnknownAttributes), UserHash(UserHash), UserName(UserName), XorMappedAddress(XorMappedAddress),
}
Expand description

STUN Attributes that can be attached to a StunMessage

Variants§

§

Unknown(Unknown)

The Unknownatribute

§

AlternateServer(AlternateServer)

The AlternateServeratribute

§

ErrorCode(ErrorCode)

The ErrorCodeatribute

§

Fingerprint(Fingerprint)

The Fingerprintatribute

§

MappedAddress(MappedAddress)

The MappedAddressatribute

§

MessageIntegrity(MessageIntegrity)

The MessageIntegrityatribute

§

MessageIntegritySha256(MessageIntegritySha256)

The MessageIntegritySha256atribute

§

Nonce(Nonce)

The Nonceatribute

§

PasswordAlgorithm(PasswordAlgorithm)

The PasswordAlgorithmatribute

§

PasswordAlgorithms(PasswordAlgorithms)

The PasswordAlgorithmsatribute

§

Realm(Realm)

The Realmatribute

§

Software(Software)

The Softwareatribute

§

UnknownAttributes(UnknownAttributes)

The UnknownAttributesatribute

§

UserHash(UserHash)

The UserHashatribute

§

UserName(UserName)

The UserNameatribute

§

XorMappedAddress(XorMappedAddress)

The XorMappedAddressatribute

Implementations§

source§

impl StunAttribute

source

pub fn attribute_type(&self) -> AttributeType

Returns the STUN attribute type of this instance.

source

pub fn is_unknown(&self) -> bool

Returns true if this StunAttribute is Unknown

source

pub fn as_unknown(&self) -> Result<&Unknown, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Unknown

source

pub fn expect_unknown(&self) -> &Unknown

Returns a reference to the Unknown attribute.

§Panics

Panics if the attribute is not an Unknown

source

pub fn is_alternate_server(&self) -> bool

Returns true if this StunAttribute is AlternateServer

source

pub fn as_alternate_server(&self) -> Result<&AlternateServer, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not AlternateServer

source

pub fn expect_alternate_server(&self) -> &AlternateServer

Returns a reference to the AlternateServer attribute.

§Panics

Panics if the attribute is not an AlternateServer

source

pub fn is_error_code(&self) -> bool

Returns true if this StunAttribute is ErrorCode

source

pub fn as_error_code(&self) -> Result<&ErrorCode, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not ErrorCode

source

pub fn expect_error_code(&self) -> &ErrorCode

Returns a reference to the ErrorCode attribute.

§Panics

Panics if the attribute is not an ErrorCode

source

pub fn is_fingerprint(&self) -> bool

Returns true if this StunAttribute is Fingerprint

source

pub fn as_fingerprint(&self) -> Result<&Fingerprint, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Fingerprint

source

pub fn expect_fingerprint(&self) -> &Fingerprint

Returns a reference to the Fingerprint attribute.

§Panics

Panics if the attribute is not an Fingerprint

source

pub fn is_mapped_address(&self) -> bool

Returns true if this StunAttribute is MappedAddress

source

pub fn as_mapped_address(&self) -> Result<&MappedAddress, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not MappedAddress

source

pub fn expect_mapped_address(&self) -> &MappedAddress

Returns a reference to the MappedAddress attribute.

§Panics

Panics if the attribute is not an MappedAddress

source

pub fn is_message_integrity(&self) -> bool

Returns true if this StunAttribute is MessageIntegrity

source

pub fn as_message_integrity(&self) -> Result<&MessageIntegrity, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not MessageIntegrity

source

pub fn expect_message_integrity(&self) -> &MessageIntegrity

Returns a reference to the MessageIntegrity attribute.

§Panics

Panics if the attribute is not an MessageIntegrity

source

pub fn is_message_integrity_sha256(&self) -> bool

Returns true if this StunAttribute is MessageIntegritySha256

source

pub fn as_message_integrity_sha256( &self ) -> Result<&MessageIntegritySha256, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not MessageIntegritySha256

source

pub fn expect_message_integrity_sha256(&self) -> &MessageIntegritySha256

Returns a reference to the MessageIntegritySha256 attribute.

§Panics

Panics if the attribute is not an MessageIntegritySha256

source

pub fn is_nonce(&self) -> bool

Returns true if this StunAttribute is Nonce

source

pub fn as_nonce(&self) -> Result<&Nonce, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Nonce

source

pub fn expect_nonce(&self) -> &Nonce

Returns a reference to the Nonce attribute.

§Panics

Panics if the attribute is not an Nonce

source

pub fn is_password_algorithm(&self) -> bool

Returns true if this StunAttribute is PasswordAlgorithm

source

pub fn as_password_algorithm(&self) -> Result<&PasswordAlgorithm, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not PasswordAlgorithm

source

pub fn expect_password_algorithm(&self) -> &PasswordAlgorithm

Returns a reference to the PasswordAlgorithm attribute.

§Panics

Panics if the attribute is not an PasswordAlgorithm

source

pub fn is_password_algorithms(&self) -> bool

Returns true if this StunAttribute is PasswordAlgorithms

source

pub fn as_password_algorithms(&self) -> Result<&PasswordAlgorithms, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not PasswordAlgorithms

source

pub fn expect_password_algorithms(&self) -> &PasswordAlgorithms

Returns a reference to the PasswordAlgorithms attribute.

§Panics

Panics if the attribute is not an PasswordAlgorithms

source

pub fn is_realm(&self) -> bool

Returns true if this StunAttribute is Realm

source

pub fn as_realm(&self) -> Result<&Realm, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Realm

source

pub fn expect_realm(&self) -> &Realm

Returns a reference to the Realm attribute.

§Panics

Panics if the attribute is not an Realm

source

pub fn is_software(&self) -> bool

Returns true if this StunAttribute is Software

source

pub fn as_software(&self) -> Result<&Software, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not Software

source

pub fn expect_software(&self) -> &Software

Returns a reference to the Software attribute.

§Panics

Panics if the attribute is not an Software

source

pub fn is_unknown_attributes(&self) -> bool

Returns true if this StunAttribute is UnknownAttributes

source

pub fn as_unknown_attributes(&self) -> Result<&UnknownAttributes, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not UnknownAttributes

source

pub fn expect_unknown_attributes(&self) -> &UnknownAttributes

Returns a reference to the UnknownAttributes attribute.

§Panics

Panics if the attribute is not an UnknownAttributes

source

pub fn is_user_hash(&self) -> bool

Returns true if this StunAttribute is UserHash

source

pub fn as_user_hash(&self) -> Result<&UserHash, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not UserHash

source

pub fn expect_user_hash(&self) -> &UserHash

Returns a reference to the UserHash attribute.

§Panics

Panics if the attribute is not an UserHash

source

pub fn is_user_name(&self) -> bool

Returns true if this StunAttribute is UserName

source

pub fn as_user_name(&self) -> Result<&UserName, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not UserName

source

pub fn expect_user_name(&self) -> &UserName

Returns a reference to the UserName attribute.

§Panics

Panics if the attribute is not an UserName

source

pub fn is_xor_mapped_address(&self) -> bool

Returns true if this StunAttribute is XorMappedAddress

source

pub fn as_xor_mapped_address(&self) -> Result<&XorMappedAddress, StunError>

Returns a reference to the internal attribute value or an error if the type of the attribute is not XorMappedAddress

source

pub fn expect_xor_mapped_address(&self) -> &XorMappedAddress

Returns a reference to the XorMappedAddress attribute.

§Panics

Panics if the attribute is not an XorMappedAddress

Trait Implementations§

source§

impl Debug for StunAttribute

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<AlternateServer> for StunAttribute

source§

fn from(value: AlternateServer) -> Self

Converts to this type from the input type.
source§

impl From<ErrorCode> for StunAttribute

source§

fn from(value: ErrorCode) -> Self

Converts to this type from the input type.
source§

impl From<Fingerprint> for StunAttribute

source§

fn from(value: Fingerprint) -> Self

Converts to this type from the input type.
source§

impl From<MappedAddress> for StunAttribute

source§

fn from(value: MappedAddress) -> Self

Converts to this type from the input type.
source§

impl From<MessageIntegrity> for StunAttribute

source§

fn from(value: MessageIntegrity) -> Self

Converts to this type from the input type.
source§

impl From<MessageIntegritySha256> for StunAttribute

source§

fn from(value: MessageIntegritySha256) -> Self

Converts to this type from the input type.
source§

impl From<Nonce> for StunAttribute

source§

fn from(value: Nonce) -> Self

Converts to this type from the input type.
source§

impl From<PasswordAlgorithm> for StunAttribute

source§

fn from(value: PasswordAlgorithm) -> Self

Converts to this type from the input type.
source§

impl From<PasswordAlgorithms> for StunAttribute

source§

fn from(value: PasswordAlgorithms) -> Self

Converts to this type from the input type.
source§

impl From<Realm> for StunAttribute

source§

fn from(value: Realm) -> Self

Converts to this type from the input type.
source§

impl From<Software> for StunAttribute

source§

fn from(value: Software) -> Self

Converts to this type from the input type.
source§

impl From<Unknown> for StunAttribute

source§

fn from(value: Unknown) -> Self

Converts to this type from the input type.
source§

impl From<UnknownAttributes> for StunAttribute

source§

fn from(value: UnknownAttributes) -> Self

Converts to this type from the input type.
source§

impl From<UserHash> for StunAttribute

source§

fn from(value: UserHash) -> Self

Converts to this type from the input type.
source§

impl From<UserName> for StunAttribute

source§

fn from(value: UserName) -> Self

Converts to this type from the input type.
source§

impl From<XorMappedAddress> for StunAttribute

source§

fn from(value: XorMappedAddress) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V