docs: Add Rustdoc to gzip and user meta plugins, mark PLAN.md tasks done
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -27,6 +27,11 @@ use flate2::write::GzEncoder;
|
||||
use crate::compression_engine::CompressionEngine;
|
||||
|
||||
#[derive(Debug, Eq, PartialEq, Clone, Default)]
|
||||
/// GZip compression engine implementation.
|
||||
///
|
||||
/// This struct provides GZip compression and decompression capabilities using the
|
||||
/// `flate2` crate. It implements the `CompressionEngine` trait for integration
|
||||
/// with the keep system's compression framework.
|
||||
pub struct CompressionEngineGZip {}
|
||||
|
||||
impl CompressionEngineGZip {
|
||||
@@ -119,7 +124,7 @@ impl CompressionEngine for CompressionEngineGZip {
|
||||
/// let writer = engine.create("/path/to/file.gz".into()).expect("Create failed");
|
||||
/// ```
|
||||
fn create(&self, file_path: PathBuf) -> Result<Box<dyn Write>> {
|
||||
debug!("COMPRESSION: Writting to {:?} using {:?}", file_path, *self);
|
||||
debug!("COMPRESSION: Writing to {:?} using {:?}", file_path, *self);
|
||||
|
||||
let file = File::create(file_path)?;
|
||||
let gzip_write = GzEncoder::new(file, Compression::default());
|
||||
@@ -128,6 +133,11 @@ impl CompressionEngine for CompressionEngineGZip {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
/// Wrapper around `GzEncoder` that automatically finishes the compression stream on drop.
|
||||
///
|
||||
/// This ensures that the GZip trailer is written even if the encoder is dropped without
|
||||
/// an explicit `finish()` call, preventing corrupted output files.
|
||||
pub struct AutoFinishGzEncoder<W: Write> {
|
||||
encoder: Option<GzEncoder<W>>,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user