use std::error::Error;
use std::fmt::Debug;
use std::hash::Hash;
pub trait ConsumeAttempt: Send + Clone {
type TransformRequestIdentifier: Eq + Hash + Send + Sync + Debug;
type TransformAttemptIdentifier: Eq + Hash + Send + Sync + Debug;
type Identifier: Eq
+ Hash
+ Send
+ Sync
+ Clone
+ Debug
+ Into<Self::TransformAttemptIdentifier>
+ Into<Self::TransformRequestIdentifier>;
type ConsumeCtx: Send;
type ConsumeVal: Send;
type ReturnCtx: Send + Clone;
type ConsumeError: Send + Error;
fn request_id(&self) -> Self::TransformRequestIdentifier;
fn attempt_id(&self) -> Self::TransformAttemptIdentifier;
fn consume_id(&self) -> Self::Identifier;
fn set_return_context(&mut self, ctx: Self::ReturnCtx);
fn get_dyn_configs(&self) -> Vec<(String, Vec<u8>)>;
}
#[cfg(test)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct NilCA;
#[cfg(test)]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct NilCAError;
#[cfg(test)]
impl std::fmt::Display for NilCAError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "NilCAError: This is a placeholder error for NilCA")
}
}
#[cfg(test)]
impl std::error::Error for NilCAError {}
#[cfg(test)]
impl ConsumeAttempt for NilCA {
type ConsumeCtx = ();
type ConsumeError = NilCAError;
type ConsumeVal = ();
type Identifier = ();
type ReturnCtx = ();
type TransformAttemptIdentifier = ();
type TransformRequestIdentifier = ();
fn request_id(&self) -> Self::TransformRequestIdentifier { () }
fn attempt_id(&self) -> Self::TransformAttemptIdentifier { () }
fn consume_id(&self) -> Self::Identifier { () }
fn set_return_context(&mut self, _ctx: Self::ReturnCtx) {}
fn get_dyn_configs(&self) -> Vec<(String, Vec<u8>)> { vec![] }
}