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 the kind's magic
11    BadMagic,
12    /// the header's validity token is not the one the kind requires; carries
13    /// the token found
14    ValidityMismatch(u32),
15    /// header promises more metadata than the image holds
16    TruncatedMeta,
17    /// metadata block is not decodable postcard
18    Decode,
19    /// metadata decoded without reading the whole block; carries the number of
20    /// bytes left over
21    TrailingMeta(usize),
22    /// metadata could not be serialized
23    Encode,
24}