use crate::error::Result;
use std::any::Any;
use std::future::Future;
use std::pin::Pin;
use std::sync::Arc;
pub type BoxedNextFn =
Box<dyn FnOnce(Box<dyn Any + Send>, Arc<dyn IServiceResolver>) -> BoxedPipelineFuture + Send>;
pub type BoxedPipelineFuture = Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>>> + Send>>;
pub trait IServiceResolver: Send + Sync {
fn get_any(&self, type_name: &str) -> Option<Box<dyn Any + Send>>;
}
#[async_trait::async_trait]
pub trait IPipelineBehavior: Send + Sync {
async fn handle(
&self,
req: Box<dyn Any + Send>,
next: BoxedNextFn,
svc: Arc<dyn IServiceResolver>,
) -> Result<Box<dyn Any + Send>>;
}