Skip to content

Update the example hello #1852

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

Merged
merged 2 commits into from
Jul 10, 2019

Conversation

liufuyang
Copy link
Contributor

Something like this?

There is a call on make_service_fn and service_fn. Is it possible to make it even simpler?

@liufuyang liufuyang force-pushed the fuyang-update-example-hello branch from 083b979 to 327fc39 Compare July 10, 2019 14:33
Copy link
Member

@seanmonstar seanmonstar left a comment

Choose a reason for hiding this comment

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

Yep, like this! We can also git rid of the error handling and just return Result<(), Box<dyn std::error::Error>> from main, since that will do the same thing automatically.

@seanmonstar seanmonstar merged commit 67c4781 into hyperium:master Jul 10, 2019
@seanmonstar
Copy link
Member

Thank you!

@liufuyang
Copy link
Contributor Author

@seanmonstar Thank you. BTW, there is no way to remove those make_service_fn and service_fn?
I am no expert but it feels they seem like some boilerplates can be removed somehow? 🤔

@liufuyang liufuyang deleted the fuyang-update-example-hello branch July 10, 2019 17:10
@seanmonstar
Copy link
Member

Maybe eventually! It's that the server needs some MakeService type that will create a Service for each connection. It looks like boilerplate in such a tiny example, but so far in my experience, an application puts a lot more functionality into both pieces.

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.

2 participants