docs: add AGENT.md and update compression engine module
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
d27776ac23
commit
022bc70f53
11
src/compression_engine.rs → src/compression_engine/mod.rs
Executable file → Normal file
11
src/compression_engine.rs → src/compression_engine/mod.rs
Executable file → Normal file
@@ -3,6 +3,7 @@ use std::io;
|
||||
use std::io::{Read, Write};
|
||||
use std::path::PathBuf;
|
||||
use strum::IntoEnumIterator;
|
||||
use strum_macros::{Display, EnumString, EnumIter};
|
||||
|
||||
use log::*;
|
||||
|
||||
@@ -31,7 +32,7 @@ use crate::compression_engine::program::CompressionEngineProgram;
|
||||
/// use keep::compression_engine::CompressionType;
|
||||
/// assert_eq!(CompressionType::GZip.to_string(), "gzip");
|
||||
/// ```
|
||||
#[derive(Debug, Eq, PartialEq, Clone, strum::EnumIter, strum::Display, strum::EnumString, Enum)]
|
||||
#[derive(Debug, Eq, PartialEq, Clone, EnumIter, Display, EnumString, enum_map::Enum)]
|
||||
#[strum(ascii_case_insensitive)]
|
||||
pub enum CompressionType {
|
||||
LZ4,
|
||||
@@ -55,7 +56,7 @@ pub enum CompressionType {
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// ```ignore
|
||||
/// // Example usage would depend on a concrete implementation
|
||||
/// use keep::compression_engine::CompressionEngine;
|
||||
/// let engine = /* some engine */;
|
||||
@@ -80,7 +81,7 @@ pub trait CompressionEngine: Send + Sync {
|
||||
/// Returns an error if the file does not exist, is not a valid compressed file,
|
||||
/// or if decompression fails.
|
||||
fn open(&self, file_path: PathBuf) -> Result<Box<dyn Read>>;
|
||||
|
||||
|
||||
/// Creates a new compressed file for writing.
|
||||
///
|
||||
/// Creates a writer that transparently compresses data as it is written.
|
||||
@@ -218,6 +219,6 @@ pub fn get_compression_engine(ct: CompressionType) -> Result<Box<dyn Compression
|
||||
if engine.is_supported() {
|
||||
Ok(engine.clone())
|
||||
} else {
|
||||
Err(anyhow!("Compression engine for {} is not supported", ct))
|
||||
Err(anyhow!("Compression engine for {} is not supported", ct.to_string()))
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user