Skip to main content

ErrorKind

Enum ErrorKind 

Source
#[non_exhaustive]
pub enum ErrorKind { UnexpectedEof { needed: usize, remaining: usize, }, Incomplete { needed: Option<usize>, }, TrailingBytes { remaining: usize, }, TooWide { width: usize, }, Io(ErrorKind), BadMagic { expected: u128, found: u128, }, Convert { message: String, }, NotSeekable, BufferFull { cap: usize, }, }
Expand description

The cause of a BitError. #[non_exhaustive]: new variants may be added without a major version bump, so match with a wildcard arm.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

UnexpectedEof

Ran past the end of a finite input (a slice): needed bits were requested, remaining were left. Definitive — distinct from Incomplete.

Fields

§needed: usize

Bits requested.

§remaining: usize

Bits still available.

§

Incomplete

A streaming source (StreamBitReader) ran out mid-message: the caller should read more bytes and retry. needed is a best-effort byte hint (None when unknown). See BitError::is_incomplete.

Fields

§needed: Option<usize>

Best-effort estimate of additional bytes needed, if known.

§

TrailingBytes

decode_exact left whole bytes unconsumed after the message.

Fields

§remaining: usize

Number of trailing bytes.

§

TooWide

A single field exceeded the 128-bit carrier width.

Fields

§width: usize

The offending width.

§

Io(ErrorKind)

Available on crate feature std only.

An I/O error while encoding to a std::io::Write sink (the std feature).

§

BadMagic

A magic constant read off the wire did not match. Both values are the type-erased low-bit representations (Bits::into_bits).

Fields

§expected: u128

The constant the codec expected.

§found: u128

The value actually read.

§

Convert

A try_map conversion from the wire representation failed; message is the converter’s Display output.

Fields

§message: String

The converter’s error, rendered.

§

NotSeekable

A position directive (restore_position/seek) ran on a non-seekable Source (a forward-only stream). Decode from a slice (BitReader) or a seekable source instead.

§

BufferFull

A BufSource hit its retention cap before the message finished — the framed message is larger than the configured bound (never unbounded).

Fields

§cap: usize

The cap, in bytes.

Trait Implementations§

Source§

impl Clone for ErrorKind

Source§

fn clone(&self) -> ErrorKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ErrorKind

Source§

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

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

impl Eq for ErrorKind

Source§

impl PartialEq for ErrorKind

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ErrorKind

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

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 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more