refactor: update binary meta plugin to use MetaPluginResponse

Co-authored-by: aider (openai/andrew/openrouter/mistralai/mistral-medium-3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-26 16:19:12 -03:00
parent a0fcb86fce
commit 13799cd337

View File

@@ -82,7 +82,7 @@ impl MetaPlugin for BinaryMetaPlugin {
true true
} }
fn finalize(&mut self) -> Result<PluginResponse> { fn finalize(&mut self) -> Result<MetaPluginResponse> {
let mut metadata = Vec::new(); let mut metadata = Vec::new();
// Save the binary detection result when finalizing, if not already saved // Save the binary detection result when finalizing, if not already saved
@@ -95,13 +95,13 @@ impl MetaPlugin for BinaryMetaPlugin {
} }
} }
Ok(PluginResponse { Ok(MetaPluginResponse {
metadata: Some(metadata), metadata: Some(metadata),
is_finalized: true, is_finalized: true,
}) })
} }
fn update(&mut self, data: &[u8]) -> Result<PluginResponse> { fn update(&mut self, data: &[u8]) -> Result<MetaPluginResponse> {
// Calculate how much data we can still accept // Calculate how much data we can still accept
let remaining_capacity = self.max_buffer_size.saturating_sub(self.buffer.len()); let remaining_capacity = self.max_buffer_size.saturating_sub(self.buffer.len());
if remaining_capacity > 0 { if remaining_capacity > 0 {
@@ -125,7 +125,7 @@ impl MetaPlugin for BinaryMetaPlugin {
} }
} }
Ok(PluginResponse { Ok(MetaPluginResponse {
metadata: if metadata.is_empty() { None } else { Some(metadata) }, metadata: if metadata.is_empty() { None } else { Some(metadata) },
is_finalized: !metadata.is_empty(), is_finalized: !metadata.is_empty(),
}) })
@@ -135,9 +135,9 @@ impl MetaPlugin for BinaryMetaPlugin {
self.meta_name.clone() self.meta_name.clone()
} }
fn initialize(&mut self, item_id: i64) -> Result<PluginResponse> { fn initialize(&mut self, item_id: i64) -> Result<MetaPluginResponse> {
self.item_id = Some(item_id); self.item_id = Some(item_id);
Ok(PluginResponse::default()) Ok(MetaPluginResponse::default())
} }
fn configure_options(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> { fn configure_options(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> Result<()> {