#[cfg(feature = "alloc")]
extern crate alloc;
pub trait OutputSink<ErrTy> {
fn put_lits(&mut self, lits: &[u8]) -> Result<(), ErrTy>;
fn put_backref(&mut self, disp: usize, len: usize) -> Result<(), ErrTy>;
}
pub struct BufOutput<'a> {
pub pos: usize,
pub buf: &'a mut [u8],
}
impl<'a> From<&'a mut [u8]> for BufOutput<'a> {
fn from(buf: &'a mut [u8]) -> Self {
Self { pos: 0, buf }
}
}
#[cfg(feature = "alloc")]
pub struct VecOutput {
pub vec: alloc::vec::Vec<u8>,
}
#[cfg(feature = "alloc")]
impl From<alloc::vec::Vec<u8>> for VecOutput {
fn from(vec: alloc::vec::Vec<u8>) -> Self {
Self { vec }
}
}