[][src]Struct cjdns_ctrl::ErrorData

pub struct ErrorData {
    pub err_type: ErrorMessageType,
    pub switch_header: SwitchHeader,
    pub additional: Vec<u8>,
}

Body data for error type messages

additional field states for raw data, that is allowed not to be parsed.

Fields

err_type: ErrorMessageTypeswitch_header: SwitchHeaderadditional: Vec<u8>

Implementations

impl ErrorData[src]

pub const MIN_SIZE: usize[src]

ErrorData minimum size. First 4 bytes are reserved for error type code.

pub fn parse(bytes: &[u8]) -> Result<Self, ParseError>[src]

Parses raw bytes into ErrorData

Result in error in several situations:

  • input bytes length is less than ErrorData::MIN_SIZE
  • switch header parsing failed
  • received error type has zero code, which is considered as None error.

pub fn serialize(&self) -> Result<Vec<u8>, SerializeError>[src]

Serializes ErrorData instance.

ErrorData type can be instantiated directly, without using parse method. That's why serialization can result in errors in several situations:

  • instance error type has a Unrecognized or None type
  • switch header serialization failed

Trait Implementations

impl Clone for ErrorData[src]

impl Debug for ErrorData[src]

impl Eq for ErrorData[src]

impl PartialEq<ErrorData> for ErrorData[src]

impl StructuralEq for ErrorData[src]

impl StructuralPartialEq for ErrorData[src]

Auto Trait Implementations

impl RefUnwindSafe for ErrorData

impl Send for ErrorData

impl Sync for ErrorData

impl Unpin for ErrorData

impl UnwindSafe for ErrorData

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.