pub struct ErrorCode { /* private fields */ }
Expand description

ERROR-CODE attribute.

See RFC 5389 – 15.6. ERROR-CODE about this attribute.

Implementations§

source§

impl ErrorCode

source

pub const CODEPOINT: u16 = 9u16

The codepoint of the type of the attribute.

source

pub fn new(code: u16, reason_phrase: String) -> Result<Self>

Makes a new ErrorCode instance.

Errors

Note that the value of code must be in range of 300..600. If the value is out-of-range this will return an ErrorKind::InvalidInput error.

source

pub fn code(&self) -> u16

Returns the code of this error.

source

pub fn reason_phrase(&self) -> &str

Returns the reason phrase of this error.

Trait Implementations§

source§

impl Attribute for ErrorCode

§

type Decoder = ErrorCodeDecoder

The decoder of the value part of the attribute.
§

type Encoder = ErrorCodeEncoder

The encoder of the value part of the attribute.
source§

fn get_type(&self) -> AttributeType

Returns the type of the attribute.
source§

fn before_encode<A: Attribute>(&mut self, message: &Message<A>) -> Result<()>

This method is called before encoding the attribute. Read more
source§

fn after_decode<A: Attribute>(&mut self, message: &Message<A>) -> Result<()>

This method is called after decoding the attribute and before being appended to the given message. Read more
source§

impl Clone for ErrorCode

source§

fn clone(&self) -> ErrorCode

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ErrorCode

source§

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

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

impl From<AddressFamilyNotSupported> for ErrorCode

source§

fn from(_: AddressFamilyNotSupported) -> Self

Converts to this type from the input type.
source§

impl From<AllocationMismatch> for ErrorCode

source§

fn from(_: AllocationMismatch) -> Self

Converts to this type from the input type.
source§

impl From<AllocationQuotaReached> for ErrorCode

source§

fn from(_: AllocationQuotaReached) -> Self

Converts to this type from the input type.
source§

impl From<BadRequest> for ErrorCode

source§

fn from(_: BadRequest) -> Self

Converts to this type from the input type.
source§

impl From<Error> for ErrorCode

source§

fn from(f: Error) -> Self

Converts to this type from the input type.
source§

impl From<ErrorCode> for Attribute

source§

fn from(f: ErrorCode) -> Self

Converts to this type from the input type.
source§

impl From<Forbidden> for ErrorCode

source§

fn from(_: Forbidden) -> Self

Converts to this type from the input type.
source§

impl From<InsufficientCapacity> for ErrorCode

source§

fn from(_: InsufficientCapacity) -> Self

Converts to this type from the input type.
source§

impl From<MobilityForbidden> for ErrorCode

source§

fn from(_: MobilityForbidden) -> Self

Converts to this type from the input type.
source§

impl From<PeerAddressFamilyMismatch> for ErrorCode

source§

fn from(_: PeerAddressFamilyMismatch) -> Self

Converts to this type from the input type.
source§

impl From<RoleConflict> for ErrorCode

source§

fn from(_: RoleConflict) -> Self

Converts to this type from the input type.
source§

impl From<ServerError> for ErrorCode

source§

fn from(_: ServerError) -> Self

Converts to this type from the input type.
source§

impl From<StaleNonce> for ErrorCode

source§

fn from(_: StaleNonce) -> Self

Converts to this type from the input type.
source§

impl From<TryAlternate> for ErrorCode

source§

fn from(_: TryAlternate) -> Self

Converts to this type from the input type.
source§

impl From<Unauthorized> for ErrorCode

source§

fn from(_: Unauthorized) -> Self

Converts to this type from the input type.
source§

impl From<UnknownAttribute> for ErrorCode

source§

fn from(_: UnknownAttribute) -> Self

Converts to this type from the input type.
source§

impl From<UnsupportedTransportProtocol> for ErrorCode

source§

fn from(_: UnsupportedTransportProtocol) -> Self

Converts to this type from the input type.
source§

impl From<WrongCredentials> for ErrorCode

source§

fn from(_: WrongCredentials) -> Self

Converts to this type from the input type.
source§

impl Hash for ErrorCode

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq<ErrorCode> for ErrorCode

source§

fn eq(&self, other: &ErrorCode) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryAsRef<ErrorCode> for Attribute

source§

fn try_as_ref(&self) -> Option<&ErrorCode>

Attempts to convert self to a reference to T. Read more
source§

impl Eq for ErrorCode

source§

impl StructuralEq for ErrorCode

source§

impl StructuralPartialEq for ErrorCode

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.