Enum imap_codec::decode::CommandDecodeError
source · 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.
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>
impl<'a> Clone for CommandDecodeError<'a>
source§fn clone(&self) -> CommandDecodeError<'a>
fn clone(&self) -> CommandDecodeError<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<'a> Debug for CommandDecodeError<'a>
impl<'a> Debug for CommandDecodeError<'a>
source§impl<'a> IntoBoundedStatic for CommandDecodeError<'a>
impl<'a> IntoBoundedStatic for CommandDecodeError<'a>
§type Static = CommandDecodeError<'static>
type Static = CommandDecodeError<'static>
'static
lifetime.source§fn into_static(self) -> Self::Static
fn into_static(self) -> Self::Static
T
into an owned T
such that T: 'static
.source§impl<'a> PartialEq<CommandDecodeError<'a>> for CommandDecodeError<'a>
impl<'a> PartialEq<CommandDecodeError<'a>> for CommandDecodeError<'a>
source§fn eq(&self, other: &CommandDecodeError<'a>) -> bool
fn eq(&self, other: &CommandDecodeError<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.