pub enum CommandDecodeError<'a> {
    Incomplete,
    LiteralFound {
        tag: Tag<'a>,
        length: u32,
        mode: LiteralMode,
    },
    Failed,
}
Expand description

Error during command decoding.

Variants§

§

Incomplete

More data is needed.

§

LiteralFound

Fields

§tag: Tag<'a>

The corresponding command (tag) to which this literal is bound.

This is required to reject literals, e.g., when their size exceeds a limit.

§length: u32

Literal length.

§mode: LiteralMode

Literal mode, i.e., sync or non-sync.

More data is needed (and further action may be necessary).

The decoder stopped at the beginning of literal data. Typically, a server MUST send a command continuation request to agree to the receival of the remaining data. This behaviour is different when LITERAL+/LITERAL- is used.

With LITERAL+/LITERAL-

When the mode is sync, everything is the same as above.

When the mode is non-sync, and the server advertised the LITERAL+ capability, it MUST NOT send a command continuation request and accept the data right away.

When the mode is non-sync, and the server advertised the LITERAL- capability, and the literal length is smaller or equal than 4096, it MUST NOT send a command continuation request and accept the data right away.

When the mode is non-sync, and the server advertised the LITERAL- capability, and the literal length is greater than 4096, it MUST be handled as sync.

match mode {
    LiteralMode::Sync => /* Same as sync. */
    LiteralMode::Sync => match advertised {
        Capability::LiteralPlus => /* Accept data right away. */
        Capability::LiteralMinus => {
            if literal_length <= 4096 {
                /* Accept data right away. */
            } else {
                /* Same as sync. */
            }
        }
    }
}
§

Failed

Decoding failed.

Trait Implementations§

source§

impl<'a> Clone for CommandDecodeError<'a>

source§

fn clone(&self) -> CommandDecodeError<'a>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for CommandDecodeError<'a>

source§

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

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

impl<'a> IntoBoundedStatic for CommandDecodeError<'a>

§

type Static = CommandDecodeError<'static>

The target type is bounded by the 'static lifetime.
source§

fn into_static(self) -> Self::Static

Convert an owned T into an owned T such that T: 'static.
source§

impl<'a> PartialEq<CommandDecodeError<'a>> for CommandDecodeError<'a>

source§

fn eq(&self, other: &CommandDecodeError<'a>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> ToBoundedStatic for CommandDecodeError<'a>

§

type Static = CommandDecodeError<'static>

The target type is bounded by the 'static lifetime.
source§

fn to_static(&self) -> Self::Static

Convert an &T to an owned T such that T: 'static.
source§

impl<'a> Eq for CommandDecodeError<'a>

source§

impl<'a> StructuralEq for CommandDecodeError<'a>

source§

impl<'a> StructuralPartialEq for CommandDecodeError<'a>

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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

§

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.