frdt 0.2.1

Edit and inspect Resonite FrDT (.brson) documents without expanding them to JSON
Documentation
use std::io;
use std::sync::PoisonError;

use thiserror::Error;

/// Errors from opening, walking, or editing an FrDT document.
#[derive(Debug, Error)]
pub enum Error {
    #[error("FrDT magic is missing")]
    BadMagic,
    #[error("reserved header bytes are not zero")]
    BadReserved,
    #[error("unsupported compression method {0:#x}")]
    UnsupportedCompression(u64),
    #[error("truncated input")]
    Truncated,
    #[error("unsupported BSON type {0:#x}")]
    UnsupportedType(u8),
    #[error("invalid BSON: {0}")]
    Invalid(String),
    #[error("slot not found")]
    NotFound,
    #[error("field not found: {0}")]
    FieldNotFound(String),
    #[error("BSON document exceeds the 32-bit length prefix")]
    TooLarge,
    #[error("brotli quality must be 4, 5, or 6")]
    BadQuality,
    #[error("document lock poisoned")]
    Poisoned,
    #[error("io: {0}")]
    Io(#[from] io::Error),
}

pub type Result<T> = std::result::Result<T, Error>;

impl<T> From<PoisonError<T>> for Error {
    fn from(_: PoisonError<T>) -> Self {
        Error::Poisoned
    }
}