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

Separate error type for parse vs FromStr #95

Closed

Conversation

waywardmonkeys
Copy link
Collaborator

The error type ParseError will shortly use a lifetime to have a lifetime bound tied to the input data.

The error type for FromStr is not permitted to have a lifetime bound, so using the same type isn't possible.

The error type `ParseError` will shortly use a lifetime to have
a lifetime bound tied to the input data.

The error type for `FromStr` is not permitted to have a lifetime
bound, so using the same type isn't possible.
@nicoburns
Copy link
Contributor

Would it make sense to have a range of indexes in the error type instead to avoid this issue? (would also potentially be more convenient for consumers of the library if the error type isn't borrowing the input).

@tomcur
Copy link
Member

tomcur commented Dec 16, 2024

I think Nico's suggestion of using a range makes sense. Having the range is also useful for consumers if they want to print an error message where the error is pointed out in context.

@waywardmonkeys waywardmonkeys marked this pull request as draft December 18, 2024 04:42
@waywardmonkeys
Copy link
Collaborator Author

There are problems with ranges with the current code, but not something that can't be solved well enough.

This would break the ability to do #111 and I prefer having #111 to this.

@waywardmonkeys waywardmonkeys deleted the error-handling branch December 27, 2024 16:30
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.

3 participants