pub enum Error {
Show 29 variants
BadMagic,
UnsupportedVersion {
found: u8,
supported: u8,
},
MalformedHeader(&'static str),
Truncated,
OutOfBounds,
IndexOutOfBounds,
BadUtf8,
BadSchema(String),
TypeMismatch {
expected: String,
got: String,
},
Incompatible(String),
UnknownFieldId(u16),
DuplicateField(u16),
DuplicateMapKey,
BadUnionTag(u32),
MissingField(u16),
SchemaIdMismatch {
message: u128,
expected: u128,
},
NoInlineSchema,
DepthLimitExceeded,
TraversalBudgetExceeded,
MessageTooLarge,
BadContainer(&'static str),
BadFile(&'static str),
UnsupportedFileFeature(u32),
NoValidFooter,
MissingSchema(u128),
AlreadyLocked(String),
ChecksumMismatch {
id: u64,
expected: u32,
found: u32,
},
Io(String),
Internal(&'static str),
}Variants§
BadMagic
Message does not start with the “VRT” magic family at all — not a Veritate message.
UnsupportedVersion
A Veritate message (“VRT” prefix) whose version byte this decoder does
not implement. found is the version digit in the magic; supported
is what this build understands. Guarantees a vN message can never be
silently misread as vM.
MalformedHeader(&'static str)
The fixed header is structurally invalid for this version: an unknown flag bit, or a reserved field that is not zero.
Truncated
Buffer too short for the fixed header or a declared region.
OutOfBounds
An offset or length points outside the message buffer.
IndexOutOfBounds
List element index past the end of the list.
BadUtf8
A string field holds invalid UTF-8.
BadSchema(String)
The (inline) schema bytes are malformed or non-canonical.
TypeMismatch
A value’s type does not match the schema field type (write path), or a typed getter was used on a differently-typed field (read path).
Incompatible(String)
Writer and reader schema cannot be resolved (e.g. int narrowing).
UnknownFieldId(u16)
A value referenced a field ID that is not in the schema.
DuplicateField(u16)
The same field ID appeared twice in one struct value.
DuplicateMapKey
The same key appeared twice in one map value.
BadUnionTag(u32)
A union value or wire tag selected a variant index that does not exist.
MissingField(u16)
A dense struct was encoded without one of its (mandatory) fields.
SchemaIdMismatch
The message’s schema id does not match the resolver’s writer schema (or the inline schema bytes hash to something else).
NoInlineSchema
dump_json needs an inline schema but the message was hash-only.
DepthLimitExceeded
Recursion (nested structs/lists) exceeded the safety depth limit — the message may contain an offset cycle or hostile nesting.
TraversalBudgetExceeded
A bounded read exhausted its traversal budget: the message followed
offsets that would touch more bytes than the budget allows (an
amplification guard for untrusted input — see Budget / the wire spec §5.2).
MessageTooLarge
Message would exceed the 4 GiB u32-offset limit.
BadContainer(&'static str)
A .vertc container file is malformed: bad magic/version, an index
pointing out of bounds, a misaligned or overlapping record, etc.
BadFile(&'static str)
A .verit file is structurally malformed: bad magic or version, a
nonzero reserved field, an index entry pointing outside the record
region, a misaligned offset, and so on.
UnsupportedFileFeature(u32)
The .verit file sets a bit in required_features that this build does
not implement, so it cannot be read correctly (File Format
Specification §3.1). Unknown optional feature bits are ignored, not
reported here.
No valid footer was found anywhere in a .verit file, so no committed
state is recoverable — the file was destroyed, not merely torn.
MissingSchema(u128)
A .verit file’s index references a schema id its schema section does
not contain, so the file is not self-contained.
AlreadyLocked(String)
Another writer already holds this file’s advisory lock. The format allows one writer and many readers (File Format Specification §7.3); concurrent writers are undefined, so this refuses rather than racing. Carries the lock file’s path — delete it by hand if a previous writer was killed.
ChecksumMismatch
A record’s bytes do not match the CRC-32 the file stored for it — bit
rot, or a tampered record. Only reachable on a file written with
per-record checksums (OPT_RECORD_CRC). Names the record’s stable id
rather than its position, since positions shift.
Fields
Io(String)
The underlying I/O operation failed. Carried as a string so Error
stays Clone + PartialEq (std::io::Error is neither).
Internal(&'static str)
Internal invariant violation (a bug in this library).
Trait Implementations§
impl Eq for Error
Source§impl Error for Error
impl Error for Error
1.30.0 · 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()