-
Notifications
You must be signed in to change notification settings - Fork 274
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
Remove boxing and allow IntoFuture #199
Conversation
/// Asynchronous Method | ||
pub trait RpcMethodSimple: Send + Sync + 'static { | ||
/// Output future | ||
type Out: Future<Item = Value, Error = Error> + Send; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not bound this by IntoFuture
also and bump the .into_future
call up the chain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Consistency:
RpcMethod:call
returnsFuture
as well Send
bound
also seems to remove the distinction between sync and async methods as a side effect? either way, super cool! one fewer allocation per RPC call and it opens the door to having |
8ed751b
to
1906651
Compare
1906651
to
16e612e
Compare
http/src/handler.rs
Outdated
@@ -46,37 +46,44 @@ impl<M: Metadata, S: Middleware<M>> server::Service for ServerHandler<M, S> { | |||
type Future = Handler<M, S>; | |||
|
|||
fn call(&self, request: Self::Request) -> Self::Future { | |||
let action = self.middleware.on_request(&request); | |||
enum MiddlewareResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually, Result
is used for cases like this. I recommend a typedef
625827c
to
d4ce60f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't noticed anything suspicious 👍
IntoFuture
in many places.RpcMethod
)