chapter-tgz 0.1.0

Specially crafted .tar.gz with embedded chapter boundary information
Documentation
//! std::io impls

use crate::TgzWriter;
use crate::refmut::RefMut;
use flate2::read::{DeflateDecoder, GzDecoder};
use std::io::{ErrorKind, Take, Write};
use std::ops::Range;

/// std::io::Write type used by [TgzWriter]
pub struct ChapterWriter<'a, W: Write> {
    pub(crate) tgz: &'a mut TgzWriter<W>,
    pub(crate) index: u32,
    pub(crate) deferred_termination_sections: bool,
}

/// std::io::Read type used by [TgzReader][crate::TgzReader]
pub struct ChapterReader<'a, R> {
    pub(crate) imp: ChapterReaderImpl<'a, R>,
}

pub(crate) enum ChapterReaderImpl<'a, R> {
    SeekTo(Range<u64>, RefMut<'a, R>),
    Smart(DeflateDecoder<Take<RefMut<'a, R>>>),
    Dumb(GzDecoder<RefMut<'a, R>>),
    Failed(ErrorKind),
}