#![cfg_attr(not(feature = "std"), no_std)]
#![deny(unsafe_code)]
#[cfg(not(feature = "std"))]
extern crate alloc;
mod decode;
#[cfg(feature = "std")]
mod encode;
#[cfg(feature = "parallel")]
pub use decode::bzz_decode_parallel;
pub use decode::{bzz_decode, decode};
#[cfg(feature = "std")]
pub use encode::bzz_encode;
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
pub enum BzzError {
#[error("BZZ input is too short")]
TooShort,
#[error("BZZ stream contains an invalid block size")]
InvalidBlockSize,
#[error("BZZ stream contains an invalid BWT index")]
InvalidBwtIndex,
#[error("ZP coder error in BZZ stream")]
ZpError,
#[error("BZZ block is missing the end-of-block marker")]
MissingMarker,
#[error("BZZ block size exceeds maximum allowed ({0} > 4 MB)")]
BlockSizeTooLarge(usize),
#[error("BZZ total output size exceeds maximum allowed (256 MB)")]
OutputTooLarge,
}
impl From<djvu_zp::ZpError> for BzzError {
fn from(_: djvu_zp::ZpError) -> Self {
BzzError::TooShort
}
}