use crate::dedupe::{DedupeDecoder, DedupeEncoder};
use crate::diff::{DiffDecoder, DiffEncoder};
pub struct EncoderContext {
pub dedupe: Option<DedupeEncoder>,
pub diff: Option<DiffEncoder>,
}
impl Default for EncoderContext {
fn default() -> Self {
Self::new()
}
}
impl EncoderContext {
#[inline(always)]
pub const fn new() -> Self {
Self {
dedupe: None,
diff: None,
}
}
#[inline(always)]
pub fn with_dedupe() -> Self {
Self {
dedupe: Some(DedupeEncoder::new()),
diff: None,
}
}
#[inline(always)]
pub fn with_diff() -> Self {
Self {
dedupe: None,
diff: Some(DiffEncoder::new()),
}
}
#[inline(always)]
pub fn with_all() -> Self {
Self {
dedupe: Some(DedupeEncoder::new()),
diff: Some(DiffEncoder::new()),
}
}
}
pub struct DecoderContext {
pub dedupe: Option<DedupeDecoder>,
pub diff: Option<DiffDecoder>,
}
impl Default for DecoderContext {
fn default() -> Self {
Self::new()
}
}
impl DecoderContext {
#[inline(always)]
pub const fn new() -> Self {
Self {
dedupe: None,
diff: None,
}
}
#[inline(always)]
pub fn with_dedupe() -> Self {
Self {
dedupe: Some(DedupeDecoder::new()),
diff: None,
}
}
#[inline(always)]
pub fn with_diff() -> Self {
Self {
dedupe: None,
diff: Some(DiffDecoder::new()),
}
}
#[inline(always)]
pub fn with_all() -> Self {
Self {
dedupe: Some(DedupeDecoder::new()),
diff: Some(DiffDecoder::new()),
}
}
}