autozstd 0.2.1

Zstd envelope compression with automatic raw fallback and magicless frames
Documentation
use std::result;

use thiserror::Error;

/// Errors returned when decoding an envelope.
#[derive(Error, Debug)]
pub enum Error {
  /// The input slice was empty and contained no type tag.
  #[error("empty envelope")]
  Empty,

  /// The leading type byte did not match any known [`Type`](crate::Type).
  #[error("invalid type tag: {0}")]
  InvalidType(u8),

  /// The decoded payload exceeds the configured output byte limit.
  #[error("decoded output exceeds {0} bytes")]
  OutputLimit(usize),

  /// Underlying Zstandard decoder error.
  #[error(transparent)]
  Decode(#[from] mzstd::DecodeError),
}

/// Result alias with [`enum@Error`].
pub type Result<T> = result::Result<T, Error>;