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

Should 'ExactlyOneError' implement std-'Error'? #482

Closed
njam opened this issue Sep 22, 2020 · 6 comments · Fixed by #484
Closed

Should 'ExactlyOneError' implement std-'Error'? #482

njam opened this issue Sep 22, 2020 · 6 comments · Fixed by #484

Comments

@njam
Copy link

njam commented Sep 22, 2020

The exactly_one() function was added in #310:

exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>> 

For using the early return operator ? on its result, it would be nice if ExactlyOneError would implement Error. Or is there any reason not to?

cc @Xaeroxe @Centril @bluss

@Xaeroxe
Copy link
Contributor

Xaeroxe commented Sep 22, 2020

Fine by me

@jswrenn
Copy link
Member

jswrenn commented Sep 22, 2020

@njam Would you like to file a PR? This would be sufficient:

impl<I: Iterator> Error for ExactlyOneError<I> {}

@Xaeroxe
Copy link
Contributor

Xaeroxe commented Sep 22, 2020

I want to PR for a small change to the innards of the thing, so I'll get it.

@Xaeroxe
Copy link
Contributor

Xaeroxe commented Sep 22, 2020

See #484

@bors bors bot closed this as completed in 4114081 Sep 29, 2020
@bors bors bot closed this as completed in #484 Sep 29, 2020
@tech6hutch
Copy link

I was just wanting this today, since the lack of Error impl makes ExactlyOneError not work well with anyhow. Is there any idea of when this enhancement will make it into the cargo version?

@jswrenn
Copy link
Member

jswrenn commented Dec 7, 2020

Thanks for poking me on this, @tech6hutch. I've been very busy. :( I'm going to try to chew threw the remaining items in our release milestone this week.

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 a pull request may close this issue.

4 participants