aboutsummaryrefslogtreecommitdiff
path: root/src/archive.rs
blob: a422f9e46b8946b0a3205ffd0bfb27141f714703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use crate::driver::{ArchiveRead, ArchiveWrite, Driver};
use crate::ArchiveResult;
use std::io::{Read, Write};

pub struct Archive<D: Driver> {
    pub(crate) driver: D,
}

impl<D: ArchiveRead> Archive<D>
where
    D::IO: std::io::Read,
{
    pub fn new(io: D::IO) -> ArchiveResult<Self, D::Error> {
        Ok(Self {
            driver: D::read(io)?,
        })
    }
}

impl<D: ArchiveWrite> Archive<D> where D::IO: Read + Write {}