Trait Service
pub trait Service<S, Request>:
Sized
+ Send
+ Sync
+ 'static {
type Response: Send + 'static;
type Error: Send + Sync + 'static;
// Required method
fn serve(
&self,
ctx: Context<S>,
req: Request,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
// Provided method
fn boxed(self) -> BoxService<S, Request, Self::Response, Self::Error> { ... }
}
Expand description
A Service
that produces rama services,
to serve requests with, be it transport layer requests or application layer requests.
Required Associated Types§
Required Methods§
Provided Methods§
fn boxed(self) -> BoxService<S, Request, Self::Response, Self::Error>
fn boxed(self) -> BoxService<S, Request, Self::Response, Self::Error>
Box this service to allow for dynamic dispatch.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.