use actix_service::{Service, ServiceFactory}; use actix_utils::future::{ready, Ready}; use crate::error::Error; use crate::request::Request; pub struct ExpectHandler; impl ServiceFactory for ExpectHandler { type Response = Request; type Error = Error; type Config = (); type Service = ExpectHandler; type InitError = Error; type Future = Ready>; fn new_service(&self, _: Self::Config) -> Self::Future { ready(Ok(ExpectHandler)) } } impl Service for ExpectHandler { type Response = Request; type Error = Error; type Future = Ready>; actix_service::always_ready!(); fn call(&self, req: Request) -> Self::Future { ready(Ok(req)) // TODO: add some way to trigger error // Err(error::ErrorExpectationFailed("test")) } }