docs: Add rustdoc comments for functions, structs, and traits
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -12,6 +12,16 @@ pub struct ReadRateMetaPlugin {
|
||||
}
|
||||
|
||||
impl ReadRateMetaPlugin {
|
||||
/// Creates a new `ReadRateMetaPlugin` instance.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `_options` - Optional configuration options for the plugin (unused in this implementation).
|
||||
/// * `outputs` - Optional output mappings for metadata.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A new instance of `ReadRateMetaPlugin`.
|
||||
pub fn new(
|
||||
_options: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
outputs: Option<std::collections::HashMap<String, serde_yaml::Value>>,
|
||||
@@ -48,14 +58,29 @@ impl ReadRateMetaPlugin {
|
||||
}
|
||||
|
||||
impl MetaPlugin for ReadRateMetaPlugin {
|
||||
/// Checks if the plugin has been finalized.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` if finalized, `false` otherwise.
|
||||
fn is_finalized(&self) -> bool {
|
||||
self.is_finalized
|
||||
}
|
||||
|
||||
/// Sets the finalized state of the plugin.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `finalized` - The new finalized state.
|
||||
fn set_finalized(&mut self, finalized: bool) {
|
||||
self.is_finalized = finalized;
|
||||
}
|
||||
|
||||
/// Finalizes the plugin, calculating the read rate.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `MetaPluginResponse` with read rate metadata and finalized state set to `true`.
|
||||
fn finalize(&mut self) -> crate::meta_plugin::MetaPluginResponse {
|
||||
// If already finalized, don't process again
|
||||
if self.is_finalized {
|
||||
@@ -94,6 +119,15 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/// Updates the plugin with new data, accumulating bytes read.
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `data` - The data chunk to process.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A `MetaPluginResponse` with empty metadata and finalized state set to `false`.
|
||||
fn update(&mut self, data: &[u8]) -> crate::meta_plugin::MetaPluginResponse {
|
||||
// If already finalized, don't process more data
|
||||
if self.is_finalized {
|
||||
@@ -113,24 +147,49 @@ impl MetaPlugin for ReadRateMetaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the type of this meta plugin.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `MetaPluginType::ReadRate`.
|
||||
fn meta_type(&self) -> MetaPluginType {
|
||||
MetaPluginType::ReadRate
|
||||
}
|
||||
|
||||
/// Returns a reference to the outputs mapping.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A reference to the `HashMap` of outputs.
|
||||
fn outputs(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.outputs
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the outputs mapping.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A mutable reference to the `HashMap` of outputs.
|
||||
fn outputs_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.outputs
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// Returns a reference to the options mapping.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A reference to the `HashMap` of options.
|
||||
fn options(&self) -> &std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&self.options
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the options mapping.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A mutable reference to the `HashMap` of options.
|
||||
fn options_mut(&mut self) -> &mut std::collections::HashMap<String, serde_yaml::Value> {
|
||||
&mut self.options
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user