pub enum ParseError {
TooShort(usize),
BadMagic,
UnsupportedVersion(u32),
NoSlabs,
SlabTableOverrun,
RootIndexOutOfRange {
index: usize,
slab_count: usize,
},
UnknownSlabType {
index: usize,
type_byte: u32,
},
UnalignedSlabLength {
index: usize,
byte_length: u32,
element_size: usize,
},
SlabDataOverrun {
index: usize,
},
RootNotJson,
}Expand description
Error reading the fixed header, slab table, or slab data extents.
Returned by Header::parse, SlabTableEntry::parse, and
ParsedFile::parse.
Variants§
TooShort(usize)
Buffer is shorter than the 20-byte fixed header. Payload is the actual buffer length.
BadMagic
The first 8 bytes do not match MAGIC.
UnsupportedVersion(u32)
The version field is not VERSION.
NoSlabs
The header’s slab_count is zero. A well-formed file always has
at least the root JSON slab.
SlabTableOverrun
The slab table extends past the end of the input buffer.
RootIndexOutOfRange
The header’s root_json_slab_index is not less than its slab_count.
UnknownSlabType
A slab-table entry’s type byte does not decode to a known
SlabType.
Fields
UnalignedSlabLength
A slab’s byte length is not a multiple of its element size.
Fields
SlabDataOverrun
A slab’s [start_offset, start_offset + byte_length) range does not
fit inside the input buffer.
RootNotJson
The slab designated by root_json_slab_index is not of type
SlabType::Json.
Trait Implementations§
Source§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
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()