pub trait Service<Request> {
type QueryResponse: Send + 'static;
type OnQueryFuture: Future<Output = Option<Self::QueryResponse>> + Send + 'static;
type OnMessageFuture: Future<Output = ()> + Send + 'static;
// Required methods
fn on_query(&self, req: Request) -> Self::OnQueryFuture;
fn on_message(&self, req: Request) -> Self::OnMessageFuture;
}Required Associated Types§
type QueryResponse: Send + 'static
type OnQueryFuture: Future<Output = Option<Self::QueryResponse>> + Send + 'static
type OnMessageFuture: Future<Output = ()> + Send + 'static
Required Methods§
Sourcefn on_query(&self, req: Request) -> Self::OnQueryFuture
fn on_query(&self, req: Request) -> Self::OnQueryFuture
Called when a query is received.
Returns a future that resolves to the either response to the query if Some,
or cancellation of the query if None.
Sourcefn on_message(&self, req: Request) -> Self::OnMessageFuture
fn on_message(&self, req: Request) -> Self::OnMessageFuture
Called when a message is received.