use std::marker::PhantomData;
use super::{Handler, IntoService, Normalize, OperationService};
use crate::shape_id::ShapeId;
pub trait OperationShape {
const ID: ShapeId;
type Input;
type Output;
type Error;
}
pub trait OperationShapeExt: OperationShape {
fn from_handler<H, Exts>(handler: H) -> IntoService<Self, H>
where
H: Handler<Self, Exts>,
Self: Sized,
{
IntoService {
handler,
_operation: PhantomData,
}
}
fn from_service<S, Exts>(svc: S) -> Normalize<Self, S>
where
S: OperationService<Self, Exts>,
Self: Sized,
{
Normalize {
inner: svc,
_operation: PhantomData,
}
}
}
impl<S> OperationShapeExt for S where S: OperationShape {}