diff options
Diffstat (limited to 'src/driver')
| -rw-r--r-- | src/driver/driver.rs | 25 | ||||
| -rw-r--r-- | src/driver/file.rs | 1 | ||||
| -rw-r--r-- | src/driver/mod.rs | 5 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/driver/driver.rs b/src/driver/driver.rs new file mode 100644 index 0000000..3a8ed16 --- /dev/null +++ b/src/driver/driver.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | use crate::driver::ArchiveFile; | ||
| 2 | use crate::ArchiveResult; | ||
| 3 | use std::error::Error; | ||
| 4 | use std::io::{Read, Write}; | ||
| 5 | |||
| 6 | pub trait Driver: Sized { | ||
| 7 | type Error: Error; | ||
| 8 | |||
| 9 | type IO; | ||
| 10 | type File: ArchiveFile; | ||
| 11 | } | ||
| 12 | |||
| 13 | pub trait ArchiveRead: Driver | ||
| 14 | where | ||
| 15 | Self::IO: Read, | ||
| 16 | { | ||
| 17 | // Create driver instance | ||
| 18 | fn read(io: Self::IO) -> ArchiveResult<Self, Self::Error>; | ||
| 19 | } | ||
| 20 | |||
| 21 | pub trait ArchiveWrite: ArchiveRead | ||
| 22 | where | ||
| 23 | Self::IO: Read + Write, | ||
| 24 | { | ||
| 25 | } | ||
diff --git a/src/driver/file.rs b/src/driver/file.rs new file mode 100644 index 0000000..a4974f3 --- /dev/null +++ b/src/driver/file.rs | |||
| @@ -0,0 +1 @@ | |||
| pub trait ArchiveFile {} | |||
diff --git a/src/driver/mod.rs b/src/driver/mod.rs new file mode 100644 index 0000000..36ee6b5 --- /dev/null +++ b/src/driver/mod.rs | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | mod driver; | ||
| 2 | mod file; | ||
| 3 | |||
| 4 | pub use driver::{ArchiveRead, ArchiveWrite, Driver}; | ||
| 5 | pub use file::ArchiveFile; | ||
