[][src]Enum byte::Error

pub enum Error {
    Incomplete,
    BadOffset(usize),
    BadInput {
        err: &'static str,
    },
}

The error type for byte crate.

  • Error::BadOffset will be returned when the offset parameter exceedes slice's length.

  • Error::BadInput and Error::Incomplete will be returned when try_read() and try_write() finds the bytes is not valid or not long enough to determin whether it's valid.

Note that we usually use bytes.read() in try_read() which may returns Error::BadOffset, which indicates an incomplete data. So the error will automatically be converted into Error::Incomplete if you use bytes.read(). (same for write())

Variants

Incomplete

The requested data is bigger than available range

BadOffset(usize)

The offset is invalid

BadInput

The requested data content is invalid

Fields of BadInput

err: &'static str

Trait Implementations

impl PartialEq<Error> for Error[src]

impl Eq for Error[src]

impl Debug for Error[src]

impl Copy for Error[src]

impl Clone for Error[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for Error

impl Sync for Error

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

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

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