pub trait Endpoint<Req: DeserializeOwned + Send + 'static, Resp: Serialize>: Send + Sync {
// Required method
fn respond<'life0, 'async_trait>(
&'life0 self,
req: Request<Req>,
) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
An Endpoint asynchronously responds to Requests.
Required Methods§
Sourcefn respond<'life0, 'async_trait>(
&'life0 self,
req: Request<Req>,
) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn respond<'life0, 'async_trait>(
&'life0 self,
req: Request<Req>,
) -> Pin<Box<dyn Future<Output = Result<Resp>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle a request. This should not block. Implementations should do things like move the Request to background tasks/threads to avoid this.