Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

middleware: RpcServiceT make it possible to use !BoxedFuture #1238

Closed
Tracked by #1241
niklasad1 opened this issue Nov 16, 2023 · 0 comments · Fixed by #1242
Closed
Tracked by #1241

middleware: RpcServiceT make it possible to use !BoxedFuture #1238

niklasad1 opened this issue Nov 16, 2023 · 0 comments · Fixed by #1242

Comments

@niklasad1
Copy link
Member

#1215 (comment)

After #1215 was merged a new RpcServiceT which requires the Future to be boxed and because it is used for every JSON-RPC call it can significantly increase the memory usage if many layers are used.

Let's introduce a trait that makes it possible to not box all futures:

pub trait RpcServiceT<'a> {
    /// The future response value.
    type Future<'cx>: Future<Output = MethodResponse>>
    where
        Self: 'cx,
        Request: 'cx;

    /// Process the request and return the response asynchronously.
    fn call(&self, req: Request<'a>) -> Self::Future<'_>;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant