Closed
Description
Currently the RpcServiceT is very similar to the tower::Service
pub trait RpcServiceT<'a> {
/// The future response value.
type Future: Future<Output = MethodResponse> + Send;
/// Process a single JSON-RPC call it may be a subscription or regular call.
/// In this interface they are treated in the same way but it's possible to
/// distinguish those based on the `MethodResponse`.
fn call(&self, request: Request<'a>) -> Self::Future;
and it should be modified to
pub trait RpcServiceT<'a> {
/// Process a single JSON-RPC call it may be a subscription or regular call.
/// In this interface they are treated in the same way but it's possible to
/// distinguish those based on the `MethodResponse`.
fn call(&self, request: Request<'a>) -> impl Future<Output = MethodResponse> + Send;
}
The reason is that in many cases the current design ends up with that the Future needs to be Boxed
or a complicated ResponseFuture has to be written. With impl Future
is much more flexible and would improve things.
The only reason why we haven't changed this is because changing this ends up with rustc generic lifetime error, rust-lang/rust#100013
Metadata
Metadata
Assignees
Labels
No labels