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:
@@ -81,8 +81,8 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
fn is_internal(&self) -> bool {
|
fn is_internal(&self) -> bool {
|
||||||
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(),
|
||||||
})
|
})
|
||||||
@@ -134,10 +134,10 @@ impl MetaPlugin for BinaryMetaPlugin {
|
|||||||
fn meta_name(&self) -> String {
|
fn meta_name(&self) -> String {
|
||||||
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<()> {
|
||||||
|
|||||||
Reference in New Issue
Block a user