fix: implement debug and default for meta plugin components
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -5,6 +5,7 @@ use which::which;
|
||||
|
||||
use crate::meta_plugin::{MetaPlugin, MetaPluginResponse, MetaPluginType};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct MetaPluginCommand {
|
||||
pub program: String,
|
||||
pub args: Vec<String>,
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
use sha2::{Digest, Sha256, Sha512};
|
||||
use md5;
|
||||
use crate::meta_plugin::{MetaPlugin, MetaPluginType};
|
||||
use std::fmt;
|
||||
use std::io::Write;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Clone)]
|
||||
enum Hasher {
|
||||
Md5(md5::Context),
|
||||
Sha256(Sha256),
|
||||
Sha512(Sha512),
|
||||
}
|
||||
|
||||
// Manual Debug implementation to avoid md5::Context not implementing Debug
|
||||
impl std::fmt::Debug for Hasher {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Hasher::Md5(_) => write!(f, "Hasher::Md5"),
|
||||
Hasher::Sha256(_) => write!(f, "Hasher::Sha256"),
|
||||
Hasher::Sha512(_) => write!(f, "Hasher::Sha512"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Hasher {
|
||||
fn update(&mut self, data: &[u8]) {
|
||||
match self {
|
||||
@@ -56,6 +66,17 @@ pub struct DigestMetaPlugin {
|
||||
options: std::collections::HashMap<String, serde_yaml::Value>,
|
||||
}
|
||||
|
||||
impl Default for DigestMetaPlugin {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
hasher: None,
|
||||
is_finalized: false,
|
||||
outputs: std::collections::HashMap::new(),
|
||||
options: std::collections::HashMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl DigestMetaPlugin {
|
||||
pub fn new(
|
||||
|
||||
Reference in New Issue
Block a user