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

Added ability to generically convert to &Endpoint without needing ownership of value #72

Closed
wants to merge 1 commit into from

Conversation

TheButlah
Copy link
Contributor

@TheButlah TheButlah commented Oct 4, 2020

Rebased on #76, suggest reviewing that one first

TryIntoEndpoint has a signature of try_into(self), which takes ownership over Self. This is not conducive to situations where we only have a &Endpoint or only need a &Endpoint returned, such as in Socket::connect(). This PR adds TryAsRefEndpoint, a failable version of AsRef<Endpoint>. This allows generically passing either &Endpoint or &str values to a function, and getting out &Endpoint, without needing to move in the endpoint or perform a clone. This allows functions that would want to take &Endpoint and return &Endpoint to be generic.

In addition, this PR breaks up the endpoints module into submodules for readability, fixes a bug associated with parsing and displaying Hosts, and fixes a flaky test.

@TheButlah
Copy link
Contributor Author

TheButlah commented Oct 4, 2020

Just rebased on top of #76, that should greatly reduce the scope of this PR. I'll rebase again when its merged so its easier to review

@TheButlah
Copy link
Contributor Author

I'm going to close this - as we discussed elsewhere, I'm not sure that avoiding a copy of the endpoint is as important for performance as I originally thought - binding and connecting are not in inner loops

@TheButlah TheButlah closed this Oct 13, 2020
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