ErrorType

Enum ErrorType 

Source
pub enum ErrorType<Byte> {
    StdIO(Error),
    ShortIO {
        bytes: usize,
        expected: usize,
    },
    InvalidByte(Byte),
}
Expand description

Input/output error type

Variants§

§

StdIO(Error)

I/O error

Wraps a std::io::Error

§

ShortIO

Short read/write error

Number of read/written bytes is less than expected according to the format: for example if input format is binary, number of input bytes must be a multiple of 8 (since 8 binary digits are needed to code a byte value); similarly, if output format is hexadecimal, writing a byte value must result in writing 2 bytes (since 2 hexadecimal digits are needed to code a byte value)

Fields

§bytes: usize
§expected: usize
§

InvalidByte(Byte)

Invalid byte read or invalid byte value to write

According to expected input format, a char read from the input can be invalid: f.e. in case of binary format any character other than ‘0’ or ‘1’ is invalid. Depending on output format, not all possible byte values can be represented; f.e. in case of ASCII format only byte values less than 128 are valid.

Trait Implementations§

Source§

impl<Byte: Debug> Debug for ErrorType<Byte>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Byte> Freeze for ErrorType<Byte>
where Byte: Freeze,

§

impl<Byte> !RefUnwindSafe for ErrorType<Byte>

§

impl<Byte> Send for ErrorType<Byte>
where Byte: Send,

§

impl<Byte> Sync for ErrorType<Byte>
where Byte: Sync,

§

impl<Byte> Unpin for ErrorType<Byte>
where Byte: Unpin,

§

impl<Byte> !UnwindSafe for ErrorType<Byte>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.