this repo has no description
1use std::io::{Read, Write};
2use std::path::Path;
3
4/// Trait for generic compression/extract over Read/Write objects
5pub trait CmprssRead {
6 fn compress<I: Read, O: Write>(&self, input: I, output: O);
7 fn extract<I: Read, O: Write>(&self, input: I, output: O);
8}
9
10/// Trait for compressing/extracting from a file.
11pub trait CmprssFile {
12 /// Compress an input file
13 fn compress_file<I: AsRef<Path>, O: Write>(&self, in_file: I, output: O);
14
15 /// Extract a file
16 fn extract_file<I: AsRef<Path>, O: Write>(&self, in_file: I, output: O);
17}
18
19pub struct CmprssCommonArgs {
20 pub compress: bool,
21 pub extract: bool,
22 pub input: String,
23 pub output: Option<String>,
24}
25
26/// Getter method for the common arguments
27pub trait CmprssArgTrait {
28 // TODO: There is probably a cleaner way to do this?
29 fn common_args(&self) -> &CmprssCommonArgs;
30}
31
32/// Generic info about the given compressor.
33pub trait CmprssInfo {
34 fn extension(&self) -> &str;
35 fn name(&self) -> &str;
36}