use super::{Handler, IntoService, Normalize, Operation, OperationService};
pub trait OperationShape {
const NAME: &'static str;
type Input;
type Output;
type Error;
}
pub trait OperationShapeExt: OperationShape {
fn from_handler<H, Exts>(handler: H) -> Operation<IntoService<Self, H>>
where
H: Handler<Self, Exts>,
Self: Sized,
{
Operation::from_handler(handler)
}
fn from_service<S, Exts, PollError>(svc: S) -> Operation<Normalize<Self, S, PollError>>
where
S: OperationService<Self, Exts, PollError>,
Self: Sized,
{
Operation::from_service(svc)
}
}
impl<S> OperationShapeExt for S where S: OperationShape {}