diff options
Diffstat (limited to 'src/archive.rs')
| -rw-r--r-- | src/archive.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/archive.rs b/src/archive.rs new file mode 100644 index 0000000..a422f9e --- /dev/null +++ b/src/archive.rs | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | use crate::driver::{ArchiveRead, ArchiveWrite, Driver}; | ||
| 2 | use crate::ArchiveResult; | ||
| 3 | use std::io::{Read, Write}; | ||
| 4 | |||
| 5 | pub struct Archive<D: Driver> { | ||
| 6 | pub(crate) driver: D, | ||
| 7 | } | ||
| 8 | |||
| 9 | impl<D: ArchiveRead> Archive<D> | ||
| 10 | where | ||
| 11 | D::IO: std::io::Read, | ||
| 12 | { | ||
| 13 | pub fn new(io: D::IO) -> ArchiveResult<Self, D::Error> { | ||
| 14 | Ok(Self { | ||
| 15 | driver: D::read(io)?, | ||
| 16 | }) | ||
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | impl<D: ArchiveWrite> Archive<D> where D::IO: Read + Write {} | ||
