appletheia_application/command/command_hasher.rs
1use thiserror::Error;
2
3use crate::command::{Command, CommandHash, CommandHashError};
4
5#[derive(Debug, Error)]
6pub enum CommandHasherError {
7 #[error("json error: {0}")]
8 Json(#[from] serde_json::Error),
9
10 #[error("command hash error: {0}")]
11 Hash(#[from] CommandHashError),
12}
13
14pub trait CommandHasher: Send + Sync {
15 fn command_hash<C: Command>(&self, command: &C) -> Result<CommandHash, CommandHasherError>;
16}