pub enum Error {
Io(Error),
Unsupported(String),
InvalidData(String),
Eof,
NeedMore,
FormatNotFound(String),
CodecNotFound(String),
ResourceExhausted(String),
Other(String),
}Expand description
The error type shared by every oxideav crate. See the module docs for which variant to pick.
Variants§
Io(Error)
An underlying transport / filesystem operation failed.
Unsupported(String)
Valid input exercising a feature this implementation lacks.
InvalidData(String)
The input violates its format’s rules; not retryable.
Eof
Logical end of stream (clean between packets; short otherwise).
NeedMore
Push-parser starvation: feed more bytes and call again.
FormatNotFound(String)
No registered container format matched the probe subject.
CodecNotFound(String)
No registered codec matched the requested name or tag.
ResourceExhausted(String)
A decoder (or arena pool) refused to allocate or proceed because
doing so would exceed a configured DecoderLimits
cap, or because a pool has no free slot. This is the canonical
“DoS protection fired” error — callers should treat it as a hard
rejection of the input or a transient backpressure signal, never
retry blindly.
Other(String)
Anything that doesn’t fit the other variants; the message carries the whole story.
Implementations§
Source§impl Error
impl Error
Sourcepub fn unsupported(msg: impl Into<String>) -> Self
pub fn unsupported(msg: impl Into<String>) -> Self
Construct an Error::Unsupported with the given message.
Sourcepub fn invalid(msg: impl Into<String>) -> Self
pub fn invalid(msg: impl Into<String>) -> Self
Construct an Error::InvalidData with the given message.
Sourcepub fn other(msg: impl Into<String>) -> Self
pub fn other(msg: impl Into<String>) -> Self
Construct an Error::Other with the given message.
Sourcepub fn resource_exhausted(msg: impl Into<String>) -> Self
pub fn resource_exhausted(msg: impl Into<String>) -> Self
Construct a Error::ResourceExhausted with the given message.
Use this from any decoder that has just hit a DecoderLimits cap
or an arena-pool exhaustion.
Sourcepub fn format_not_found(msg: impl Into<String>) -> Self
pub fn format_not_found(msg: impl Into<String>) -> Self
Construct a Error::FormatNotFound with the given probe
subject (file name, extension, or magic description).
Sourcepub fn codec_not_found(msg: impl Into<String>) -> Self
pub fn codec_not_found(msg: impl Into<String>) -> Self
Construct a Error::CodecNotFound with the codec name or tag
that missed the registry.
Sourcepub fn is_eof(&self) -> bool
pub fn is_eof(&self) -> bool
true for Error::Eof. Error cannot implement PartialEq
(the Io variant wraps std::io::Error), so drain loops that
need “stop cleanly on end-of-stream” branch on this instead of
a matches! at every call site.
Sourcepub fn is_need_more(&self) -> bool
pub fn is_need_more(&self) -> bool
true for Error::NeedMore — the push-parser “feed me more
bytes and retry” signal.
Sourcepub fn is_resource_exhausted(&self) -> bool
pub fn is_resource_exhausted(&self) -> bool
true for Error::ResourceExhausted — the “DoS cap fired”
signal that must not be blindly retried.
Sourcepub fn is_starved(&self) -> bool
pub fn is_starved(&self) -> bool
true when the error only says the stream stopped short —
Error::Eof or Error::NeedMore — rather than reporting
malformed or unsupported content. Useful for probe loops that
try successive parsers on a growing prefix: starvation means
“inconclusive, buffer more”, anything else means “this parser
has a verdict”.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()