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

Add some derives to Utf8Error #113

Closed

Conversation

TethysSvensson
Copy link
Contributor

This brings bstr::Utf8Error closer to std::str::Utf8Error.

@BurntSushi
Copy link
Owner

This looks good. I'll bring this in via a rollup PR, but I'm going to leave out the Copy impl. I'm not convinced of its utility, and in particular, Utf8Error doesn't feel like it semantically aligns with Copy. Adding Copy is also a backcompat hazard.

Also, nit: derives should be listed in lexicographic order.

@TethysSvensson
Copy link
Contributor Author

The std version implements copy and currently so does planus::Error, which I am thinking about extending to also contain errors from bstr

@TethysSvensson
Copy link
Contributor Author

Also, nit: derives should be listed in lexicographic order.

I agree. I copied the order from std and didn't pay attention.

@BurntSushi
Copy link
Owner

Yes I understand std implements Copy, but I'm not really sure that it should to be honest.

@BurntSushi
Copy link
Owner

It is pretty weird in general for an opaque error type to implement Copy IMO.

BurntSushi pushed a commit that referenced this pull request Jul 11, 2022
This matches what std::str::Utf8Error has, and it seems like a common
sense impl.

We do not add a 'Copy' impl however, since that seems like a backcompat
hazard. Although, it does seem unlikely that this error type will ever
*not* be 'Copy', it's not clear to me that 'Copy' makes semantic sense
for this type.

Closes #113
BurntSushi pushed a commit that referenced this pull request Jul 11, 2022
This matches what std::str::Utf8Error has, and it seems like a common
sense impl.

We do not add a 'Copy' impl however, since that seems like a backcompat
hazard. Although, it does seem unlikely that this error type will ever
*not* be 'Copy', it's not clear to me that 'Copy' makes semantic sense
for this type.

Closes #113
@TethysSvensson TethysSvensson deleted the utf8-error-derive branch July 11, 2022 23:12
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.

2 participants