Skip to content

refactor(examples): extract Http::new outside loops #3001

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

Closed
wants to merge 4 commits into from
Closed

refactor(examples): extract Http::new outside loops #3001

wants to merge 4 commits into from

Conversation

BastiDood
Copy link
Contributor

Hello there! Now that #2321 has been resolved, I wanted to improve the documentation for the low-level server API. In all examples, I've noticed that the Http::new function is repeatedly called in loops. I figured that it would be more efficient to extract the Http instance (out of the loop) since serve_connection takes &self anyway (i.e., no mutability necessary). I have also updated the benches and documentation accordingly.

As part of this year's Hacktoberfest, it would be greatly appreciated if this PR would be labelled with hacktoberfest-accepted. Thanks!

P.S. Thanks for the shoutout at curl-up 2022! 🎉

@BastiDood
Copy link
Contributor Author

Update: rebased onto the latest master (as of writing). 👍

@BastiDood
Copy link
Contributor Author

Closing due to #3013. Will definitely try again once the new API is stabilized. 👍

@BastiDood BastiDood closed this Oct 19, 2022
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.

1 participant