Skip to main content

concinnity_core/blob/
error.rs

1/// Why a blob image did not parse or encode.
2///
3/// Each variant carries what a caller needs to report the failure. The crate
4/// does no logging of its own: it never knows which file the bytes came from, so
5/// the caller that opened the file owns the diagnostic.
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7pub enum BlobError {
8    /// fewer bytes than the fixed header
9    TooShort,
10    /// leading bytes are not BLOB_MAGIC
11    BadMagic,
12    /// built against a different SCHEMA_VERSION; carries the version found
13    SchemaMismatch(u32),
14    /// header promises more metadata than the image holds
15    TruncatedMeta,
16    /// metadata block is not decodable postcard
17    Decode,
18    /// metadata decoded without reading the whole block; carries the number of
19    /// bytes left over
20    TrailingMeta(usize),
21    /// metadata could not be serialized
22    Encode,
23}