pub struct AddressErrorCode { /* private fields */ }Expand description
The AddressErrorCode Attribute.
Used to notofy of errors with a particular address family.
Reference: RFC8656 Section 18.12.
Implementations§
Source§impl AddressErrorCode
impl AddressErrorCode
Sourcepub fn new(family: AddressFamily, error: ErrorCode) -> Self
pub fn new(family: AddressFamily, error: ErrorCode) -> Self
Create a new AddressErrorCode Attribute.
§Examples
use stun_types::attribute::ErrorCode;
let error = ErrorCode::builder(440).build().unwrap();
let addr_error = AddressErrorCode::new(AddressFamily::IPV6, error);
assert_eq!(addr_error.family(), AddressFamily::IPV6);Sourcepub fn family(&self) -> AddressFamily
pub fn family(&self) -> AddressFamily
Retrieve the requested address family stored in an AddressErrorCode.
§Examples
use stun_types::attribute::ErrorCode;
let error = ErrorCode::builder(440).build().unwrap();
let addr_error = AddressErrorCode::new(AddressFamily::IPV6, error);
assert_eq!(addr_error.family(), AddressFamily::IPV6);Sourcepub fn error(&self) -> &ErrorCode
pub fn error(&self) -> &ErrorCode
Retrieve the error stored in an AddressErrorCode.
§Examples
use stun_types::attribute::ErrorCode;
let error = ErrorCode::builder(440).build().unwrap();
let addr_error = AddressErrorCode::new(AddressFamily::IPV6, error.clone());
assert_eq!(addr_error.family(), AddressFamily::IPV6);
assert_eq!(addr_error.error(), &error);Trait Implementations§
Source§impl Attribute for AddressErrorCode
impl Attribute for AddressErrorCode
Source§impl AttributeFromRaw<'_> for AddressErrorCode
impl AttributeFromRaw<'_> for AddressErrorCode
Source§fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw_ref(raw: &RawAttribute<'_>) -> Result<Self, StunParseError>where
Self: Sized,
Produce an
Attribute from a RawAttributeSource§fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
fn from_raw(raw: RawAttribute<'a>) -> Result<Self, StunParseError>where
Self: Sized,
Produce an
Attribute from a RawAttributeSource§impl AttributeStaticType for AddressErrorCode
impl AttributeStaticType for AddressErrorCode
Source§const TYPE: AttributeType
const TYPE: AttributeType
The
AttributeTypeSource§impl AttributeWrite for AddressErrorCode
impl AttributeWrite for AddressErrorCode
Source§fn to_raw(&self) -> RawAttribute<'_>
fn to_raw(&self) -> RawAttribute<'_>
Produce a
RawAttribute from this AttributeSource§fn write_into_unchecked(&self, dest: &mut [u8])
fn write_into_unchecked(&self, dest: &mut [u8])
Write attribute to the provided destination buffer. Read more
Source§impl Clone for AddressErrorCode
impl Clone for AddressErrorCode
Source§fn clone(&self) -> AddressErrorCode
fn clone(&self) -> AddressErrorCode
Returns a duplicate 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 AddressErrorCode
impl Debug for AddressErrorCode
Source§impl Display for AddressErrorCode
impl Display for AddressErrorCode
Source§impl TryFrom<&RawAttribute<'_>> for AddressErrorCode
impl TryFrom<&RawAttribute<'_>> for AddressErrorCode
Source§type Error = StunParseError
type Error = StunParseError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for AddressErrorCode
impl RefUnwindSafe for AddressErrorCode
impl Send for AddressErrorCode
impl Sync for AddressErrorCode
impl Unpin for AddressErrorCode
impl UnwindSafe for AddressErrorCode
Blanket Implementations§
Source§impl<A> AttributeExt for A
impl<A> AttributeExt for A
Source§impl<A> AttributeWriteExt for Awhere
A: AttributeWrite + ?Sized,
impl<A> AttributeWriteExt for Awhere
A: AttributeWrite + ?Sized,
Source§fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
fn write_header(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
Write the 4 byte attribute header into the provided destination buffer returning the
number of bytes written, or an error.
Source§fn write_header_unchecked(&self, dest: &mut [u8]) -> usize
fn write_header_unchecked(&self, dest: &mut [u8]) -> usize
Write the 4 byte attribute header into the provided destination buffer returning the
number of bytes written. Read more
Source§fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
fn write_into(&self, dest: &mut [u8]) -> Result<usize, StunWriteError>
Write this attribute into the provided destination buffer returning the number of bytes
written, or an error.
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