pub trait Service: Send + Sync {
type Data;
// Required method
fn handle(
&self,
request: &Request,
ctx: &Self::Data,
) -> Result<Option<Response>>;
}Expand description
Trait for services that maybe handle a request.
Required Associated Types§
Required Methods§
Sourcefn handle(
&self,
request: &Request,
ctx: &Self::Data,
) -> Result<Option<Response>>
fn handle( &self, request: &Request, ctx: &Self::Data, ) -> Result<Option<Response>>
Service implementations are invoked with a request and should reply with a response if the method name is one handled by the service.
If the method name for the request is not handled by the service
it should return None.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".