Struct stun_types::attribute::ErrorCode
source · pub struct ErrorCode { /* private fields */ }Expand description
The ErrorCode Attribute
Implementations§
source§impl ErrorCode
impl ErrorCode
pub const TRY_ALTERNATE: u16 = 301u16
pub const BAD_REQUEST: u16 = 400u16
pub const UNAUTHORIZED: u16 = 401u16
pub const FORBIDDEN: u16 = 403u16
pub const UNKNOWN_ATRIBUTE: u16 = 420u16
pub const ALLOCATION_MISMATCH: u16 = 437u16
pub const STALE_NONCE: u16 = 438u16
pub const ADDRESS_FAMILY_NOT_SUPPORTED: u16 = 440u16
pub const WRONG_CREDENTIALS: u16 = 441u16
pub const UNSUPPORTED_TRANSPORT_PROTOCOL: u16 = 442u16
pub const PEER_ADDRESS_FAMILY_MISMATCH: u16 = 443u16
pub const ALLOCATION_QUOTA_REACHED: u16 = 486u16
pub const ROLE_CONFLICT: u16 = 487u16
pub const SERVER_ERROR: u16 = 500u16
pub const INSUFFICIENT_CAPACITY: u16 = 508u16
sourcepub fn code(&self) -> u16
pub fn code(&self) -> u16
The error code value
§Examples
let error = ErrorCode::new (400, "bad error").unwrap();
assert_eq!(error.code(), 400);sourcepub fn reason(&self) -> &str
pub fn reason(&self) -> &str
The error code reason string
§Examples
let error = ErrorCode::new (400, "bad error").unwrap();
assert_eq!(error.reason(), "bad error");sourcepub fn default_reason_for_code(code: u16) -> &'static str
pub fn default_reason_for_code(code: u16) -> &'static str
Return some default reason strings for some error code values
Currently the following are supported.
- 301 -> Try Alternate
- 400 -> Bad Request
- 401 -> Unauthorized
- 403 -> Forbidden
- 420 -> Unknown Attribute
- 437 -> Allocation Mismatch
- 438 -> Stale Nonce
- 440 -> Address Family Not Supported
- 441 -> Wrong Credentials
- 442 -> Supported Transport Protocol
- 443 -> Peer Address Family Mismatch
- 486 -> Allocation Quota Reached
- 487 -> Role Conflict
- 500 -> Server Error
- 508 -> Insufficient Capacity
Trait Implementations§
source§impl<'a> From<&ErrorCode> for RawAttribute<'a>
impl<'a> From<&ErrorCode> for RawAttribute<'a>
source§fn from(value: &ErrorCode) -> RawAttribute<'a>
fn from(value: &ErrorCode) -> RawAttribute<'a>
Converts to this type from the input type.
source§impl PartialEq for ErrorCode
impl PartialEq for ErrorCode
source§impl<'a> TryFrom<&RawAttribute<'a>> for ErrorCode
impl<'a> TryFrom<&RawAttribute<'a>> for ErrorCode
§type Error = StunParseError
type Error = StunParseError
The type returned in the event of a conversion error.
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<E, T> AttributeFromRaw<E> for T
impl<E, T> AttributeFromRaw<E> for T
source§fn from_raw(raw: &RawAttribute<'_>) -> Result<T, E>
fn from_raw(raw: &RawAttribute<'_>) -> Result<T, E>
Convert an
Attribute from a RawAttributesource§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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)