-
Notifications
You must be signed in to change notification settings - Fork 182
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
Make ULE types Copy, add PairULE #1193
Conversation
This does minor refactorings of a lot of code, which is why it tagged everyone in as an owner. I think after this I'm going to cut a version of ZeroVec so that tinystr can be brought up to date, we've had a lot of changes and I'd like them to be published. I still have stuff to do but this is a reasonable milestone since almost all of the other stuff is additive. |
/// We do not have guarantees for the layouts of tuples, so we must define a custom | ||
/// ULE type for pairs. This could potentially be generalized for larger tuples if necessary | ||
#[repr(packed)] | ||
pub struct PairULE<A, B>(pub A, pub B); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: can we make a 3-part and 4-part ULE as well? I think we may need at least 3 for the LocaleCanonicalizer stuff (language script region).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding was that those were maps from language to script/region? We can add the 3-part one when needed imo, it should be easy to copy PairULE
IncorrectLength(/* expected */ usize, /* found */ usize), | ||
} | ||
|
||
impl<E: fmt::Display, F: fmt::Display> fmt::Display for PairULEError<E, F> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion (optional): it would be nicer to use displaydoc
but I know you don't want to add that dep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use derives on this type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good for now, and we can add 3-part or 4-part ULEs later when needed
Fixes #1184
I was adding PairULE and was hitting rust-lang/rust#82523 (comment) . I decided to use this opportunity to make things Copy anyway.
I much prefer the new API, there's no need to take superfluous
&
references to satisfy the compiler.