pub enum Error {
Truncated {
what: &'static str,
needed: usize,
found: usize,
},
InvalidMagic {
what: &'static str,
},
BadValue(&'static str),
Unsupported(&'static str),
TooLarge {
what: &'static str,
limit: usize,
},
}Expand description
The single error type of the pith suite.
Every fallible operation across the workspace returns
Result<T>, which uses this type, so a caller that
handles errors once handles all of them. Each variant carries a
&'static str naming the field or structure at fault, so a message
names a thing rather than saying “invalid input”.
Display never allocates and never runs the
formatting machinery: it concatenates the literal prefix with the
what field through Formatter::write_str
alone. The numeric payloads (needed, found, limit) stay
reachable through Debug, which derives normally.
Variants§
Truncated
Input ended before a structure that the format guarantees.
Fields
InvalidMagic
A magic number, signature or fixed field did not match.
BadValue(&'static str)
A structurally valid but semantically impossible value: a zero denominator, a declared length that cannot fit, a table index past the end of the table.
Unsupported(&'static str)
A real format variant this crate deliberately does not implement. This is not a failure to parse; it is a refusal to guess.
TooLarge
An allocation the format could request but that exceeds a configured ceiling. Always a refusal, never an OOM.