use super::proc::InjProc;
use crate::core::{adaptor::Adaptor, error::ProcError, msg::Tvf};
extern crate self as prosa;
pub trait InjAdaptor<M>
where
M: 'static
+ std::marker::Send
+ std::marker::Sync
+ std::marker::Sized
+ std::clone::Clone
+ std::fmt::Debug
+ Tvf
+ std::default::Default,
{
fn new(proc: &InjProc<M>) -> Result<Self, Box<dyn ProcError + Send + Sync>>
where
Self: Sized;
fn build_transaction(&mut self) -> M;
fn process_response(
&mut self,
_response: M,
_service_name: &str,
) -> Result<(), Box<dyn ProcError + Send + Sync>> {
Ok(())
}
}
#[derive(Adaptor)]
pub struct InjDummyAdaptor {}
impl<M> InjAdaptor<M> for InjDummyAdaptor
where
M: 'static
+ std::marker::Send
+ std::marker::Sync
+ std::marker::Sized
+ std::clone::Clone
+ std::fmt::Debug
+ Tvf
+ std::default::Default,
{
fn new(_proc: &InjProc<M>) -> Result<Self, Box<dyn ProcError + Send + Sync>> {
Ok(Self {})
}
fn build_transaction(&mut self) -> M {
let mut msg = M::default();
msg.put_string(1, "DUMMY");
msg
}
}