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

Remove boxing and allow IntoFuture #199

Merged
merged 8 commits into from
Sep 15, 2017
Merged

Remove boxing and allow IntoFuture #199

merged 8 commits into from
Sep 15, 2017

Conversation

tomusdrw
Copy link
Contributor

@tomusdrw tomusdrw commented Sep 4, 2017

@tomusdrw tomusdrw requested review from debris and rphmeier September 4, 2017 19:55
/// Asynchronous Method
pub trait RpcMethodSimple: Send + Sync + 'static {
/// Output future
type Out: Future<Item = Value, Error = Error> + Send;
Copy link
Contributor

@rphmeier rphmeier Sep 4, 2017

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Consistency: RpcMethod:call returns Future as well
  2. Send bound

@rphmeier
Copy link
Contributor

rphmeier commented Sep 4, 2017

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 impl Future RPC methods

@tomusdrw tomusdrw force-pushed the td-remove-boxfuture branch from 8ed751b to 1906651 Compare September 7, 2017 09:09
@tomusdrw tomusdrw force-pushed the td-remove-boxfuture branch from 1906651 to 16e612e Compare September 7, 2017 09:15
@@ -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 {
Copy link
Contributor

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

Copy link
Contributor

@debris debris left a 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 👍

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 this pull request may close these issues.

3 participants