use crate::compression::{
CodecImplementation, CompressionCodec, CompressionCodecType, DecompressResult,
};
use crate::error::Result;
use crate::header::CodecType;
use std::io::Write;
pub struct NoneCodec;
impl CodecImplementation for NoneCodec {
fn new(_: u32) -> Result<Self> {
Ok(NoneCodec)
}
fn decompress(&mut self, input: &[u8], mut output: &mut [u8]) -> Result<DecompressResult> {
Ok(DecompressResult::new(output.write(input)?, input.len()))
}
}
impl CompressionCodecType for NoneCodec {
fn codec_type(&self) -> CodecType {
CodecType::None
}
}
impl CompressionCodec for NoneCodec {}