feat: add thiserror and derive_more for error handling and boilerplate reduction
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -14,6 +14,7 @@ anyhow = "1.0.72"
|
|||||||
axum = "0.8.4"
|
axum = "0.8.4"
|
||||||
derive_more = "2.0"
|
derive_more = "2.0"
|
||||||
smart-default = "0.7"
|
smart-default = "0.7"
|
||||||
|
thiserror = "1.0"
|
||||||
base64 = "0.22.1"
|
base64 = "0.22.1"
|
||||||
chrono = "0.4.26"
|
chrono = "0.4.26"
|
||||||
clap = { version = "4.3.10", features = ["derive", "env"] }
|
clap = { version = "4.3.10", features = ["derive", "env"] }
|
||||||
|
|||||||
@@ -4,24 +4,13 @@ use crate::meta_plugin::{MetaPlugin, MetaPluginType};
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone, Debug)]
|
||||||
enum Hasher {
|
enum Hasher {
|
||||||
Md5(md5::Context),
|
Md5(md5::Context),
|
||||||
Sha256(Sha256),
|
Sha256(Sha256),
|
||||||
Sha512(Sha512),
|
Sha512(Sha512),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Implement Debug manually since md5::Context doesn't implement it
|
|
||||||
impl fmt::Debug for Hasher {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
match self {
|
|
||||||
Hasher::Md5(_) => write!(f, "Hasher::Md5"),
|
|
||||||
Hasher::Sha256(_) => write!(f, "Hasher::Sha256"),
|
|
||||||
Hasher::Sha512(_) => write!(f, "Hasher::Sha512"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hasher {
|
impl Hasher {
|
||||||
fn update(&mut self, data: &[u8]) {
|
fn update(&mut self, data: &[u8]) {
|
||||||
match self {
|
match self {
|
||||||
|
|||||||
Reference in New Issue
Block a user