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

Endpoint::connect_lazy should not return a Result<> #708

Closed
nbaztec opened this issue Jul 9, 2021 · 2 comments · Fixed by #712
Closed

Endpoint::connect_lazy should not return a Result<> #708

nbaztec opened this issue Jul 9, 2021 · 2 comments · Fixed by #712
Labels
Milestone

Comments

@nbaztec
Copy link
Contributor

nbaztec commented Jul 9, 2021

Feature Request

Crates

transport

Motivation

Most of the object creation and error validation is already done in Endpoint::new and as such Endpoint::connect_lazy should not be returning any errors since the connection is evaluated on-demand and cannot fail when building a channel. Meanwhile the API gives the wrong impression that the call may fail (does it ping the service beforehand? who knows)

Proposal

Change the return signature for connect_lazy to return the Channel to better indicate via API that this call can not fail due to connection errors.

Alternatives

Add a doc comment specifying that this function never fails when invoked.

@davidpdrsn
Copy link
Member

I have had the same thought. @LucioFranco do you know if there is a reason it currently returns a result? Future proofing perhaps? 🤷

@LucioFranco
Copy link
Member

Yeah, this should have been fixed in 0.5. For now the API is unfalliable and unwraping there is safe from a panic. We should remove it for the next iteration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants