pub struct ErrorCode(/* private fields */);
Expand description
The ERROR-CODE attribute is used in error response messages.
§Examples
let error = stun_rs::ErrorCode::new(420, "Unknown Attribute")?;
let attr = ErrorCode::from(error);
assert_eq!(attr.error_code().class(), 4);
assert_eq!(attr.error_code().number(), 20);
assert_eq!(attr.error_code().reason(), "Unknown Attribute");
Implementations§
source§impl ErrorCode
impl ErrorCode
sourcepub fn new(error_code: ErrorCodeType) -> Self
pub fn new(error_code: ErrorCodeType) -> Self
sourcepub fn error_code(&self) -> &ErrorCodeType
pub fn error_code(&self) -> &ErrorCodeType
Returns the error code value .
Trait Implementations§
source§impl From<ErrorCode> for ErrorCode
impl From<ErrorCode> for ErrorCode
source§fn from(error: ErrorCodeType) -> Self
fn from(error: ErrorCodeType) -> Self
Converts to this type from the input type.
source§impl From<ErrorCode> for StunAttribute
impl From<ErrorCode> for StunAttribute
source§impl StunAttributeType for ErrorCode
impl StunAttributeType for ErrorCode
source§fn get_type() -> AttributeTypewhere
Self: Sized,
fn get_type() -> AttributeTypewhere
Self: Sized,
Returns the STUN attribute type.
source§fn attribute_type(&self) -> AttributeType
fn attribute_type(&self) -> AttributeType
Returns the STUN attribute type of this instance.
impl Eq for ErrorCode
impl StructuralPartialEq for ErrorCode
Auto Trait Implementations§
impl Freeze for ErrorCode
impl RefUnwindSafe for ErrorCode
impl Send for ErrorCode
impl Sync for ErrorCode
impl Unpin for ErrorCode
impl UnwindSafe for ErrorCode
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
)