[][src]Enum koibumi_core::packet::PacketError

pub enum PacketError {
    InvalidMagic {
        expected: Magic,
        actual: Magic,
    },
    TooLong {
        max: usize,
        len: usize,
    },
    InvalidChecksum {
        expected: Checksum,
        actual: Checksum,
    },
    InvalidLength {
        expected: usize,
        actual: usize,
    },
}

An error which can be returned when constructing a Bitmessage packet.

This error is used as the error type for the Header::new() and the Packet::new() methods. This error is also used as a error type wrapped by std::io::Error for the Header::read_from_with_config() and the Packet::read_from_with_config() methods.

Variants

InvalidMagic

The magic numbers did not match. The expected and the actual magic numbers are returned as payloads of this variant.

Fields of InvalidMagic

expected: Magic

The expected magic number.

actual: Magic

The actual magic number.

TooLong

The length of the payload was too long to construct a packet. The maximum length allowed and the actual length supplied are returned as payloads of this variant.

Fields of TooLong

max: usize

The maximum length allowed.

len: usize

The actual length supplied.

InvalidChecksum

The checksums did not match. The expected and the actual checksums are returned as payloads of this variant.

Fields of InvalidChecksum

expected: Checksum

The expected checksum.

actual: Checksum

The actual checksum.

InvalidLength

The length provided by the header and the length of the actual payload did not match. The expected and the actual lengths of the payload are returned as payloads of this variant.

Fields of InvalidLength

expected: usize

The expected length.

actual: usize

The actual length.

Trait Implementations

impl Clone for PacketError[src]

impl Debug for PacketError[src]

impl Display for PacketError[src]

impl Eq for PacketError[src]

impl Error for PacketError[src]

impl From<PacketError> for Error[src]

impl PartialEq<PacketError> for PacketError[src]

impl StructuralEq for PacketError[src]

impl StructuralPartialEq for PacketError[src]

Auto Trait Implementations

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> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

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.