docs: Enhance Rustdoc for CompressionService, StatusService, and MetaPluginExec
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -5,6 +5,18 @@ use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use anyhow::anyhow;
|
||||
|
||||
//// Service for handling compression and decompression of item content.
|
||||
///
|
||||
/// Provides methods to read compressed item files either fully into memory
|
||||
/// or as streaming readers. Supports various compression types via engines.
|
||||
/// This service abstracts the underlying compression engines for consistent access.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// let service = CompressionService::new();
|
||||
/// let content = service.get_item_content(path, "gzip")?;
|
||||
/// ```
|
||||
pub struct CompressionService;
|
||||
|
||||
/// Service for handling compression and decompression of item content.
|
||||
@@ -22,9 +34,11 @@ pub struct CompressionService;
|
||||
impl CompressionService {
|
||||
/// Creates a new CompressionService instance.
|
||||
///
|
||||
/// This is a simple constructor; no initialization is required beyond the static methods.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A new `CompressionService`.
|
||||
/// * `CompressionService` - A new instance of the service.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@@ -37,19 +51,22 @@ impl CompressionService {
|
||||
|
||||
/// Reads and decompresses the full content of an item file into memory.
|
||||
///
|
||||
/// Loads the entire decompressed content as a byte vector. Suitable for small to medium files.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `item_path` - Path to the compressed item file.
|
||||
/// * `compression` - Compression type string (e.g., "gzip").
|
||||
/// * `item_path` - Path to the compressed item file on disk.
|
||||
/// * `compression` - Compression type as string (e.g., "gzip", "lz4"); case-insensitive.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<Vec<u8>, CoreError>` - Decompressed content bytes.
|
||||
/// * `Ok(Vec<u8>)` - The full decompressed content bytes.
|
||||
/// * `Err(CoreError)` - On failure (see errors).
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `CoreError::Compression(...)` - If compression type invalid.
|
||||
/// * `CoreError::Other(...)` - If file open or read fails.
|
||||
/// * `CoreError::Compression(String)` - If the compression type string is invalid.
|
||||
/// * `CoreError::Other(anyhow::Error)` - If the file cannot be opened, the engine fails, or reading encounters an I/O error.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
@@ -72,22 +89,23 @@ impl CompressionService {
|
||||
|
||||
/// Opens a streaming reader for decompressing item content.
|
||||
///
|
||||
/// For Send compatibility, reads full content into memory and returns a Cursor.
|
||||
/// Note: Not suitable for very large files due to memory usage.
|
||||
/// Due to Send requirements in async contexts, this loads the full content into a Cursor.
|
||||
/// Warning: For very large files, this consumes significant memory; consider alternatives for streaming without loading all data.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `item_path` - Path to the compressed item file.
|
||||
/// * `compression` - Compression type string.
|
||||
/// * `item_path` - Path to the compressed item file on disk.
|
||||
/// * `compression` - Compression type as string (e.g., "gzip", "lz4"); case-insensitive.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// * `Result<Box<dyn Read + Send>, CoreError>` - Boxed streaming reader.
|
||||
/// * `Ok(Box<dyn Read + Send>)` - A boxed reader that can be used for streaming decompressed data.
|
||||
/// * `Err(CoreError)` - On failure (see errors).
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `CoreError::Compression(...)` - If compression type invalid.
|
||||
/// * `CoreError::Other(...)` - If file open or read fails.
|
||||
/// * `CoreError::Compression(String)` - If the compression type string is invalid.
|
||||
/// * `CoreError::Other(anyhow::Error)` - If the file cannot be opened, the engine fails, or reading encounters an I/O error.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user