-
Notifications
You must be signed in to change notification settings - Fork 185
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
Simplify Language representation #1695
Conversation
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.
Please, use is_empty
, the rest looks good.
|
||
const LANGUAGE_LENGTH: RangeInclusive<usize> = 2..=3; | ||
const UND_VALUE: TinyAsciiStr<3> = tinystr!(3, "und"); | ||
// Safe because "und" is a valid language subtag | ||
const UND: Language = Language(unsafe { TinyAsciiStr::from_bytes_unchecked(*b"und") }); |
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 could be lang!("und")
after #1631 . @zbraniecki please take a look at that.
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.
I'll add a TODO(#348)
here, and you can fix it in your PR (which it looks like you need to rebase anyway).
Hooray! The files in the branch are the same across the force-push. 😃 ~ Your Friendly Jira-GitHub PR Checker Bot |
^ rebasing onto main. |
This PR changes
Language
from wrappingOption<TinyAsciiStr>
to justTinyAsciiStr
, with theNone
variant encoded as a literaltinystr!("und")
.There are two reasons for this change:
Language
to be its own ULE.Please let me know which benches you'd like me to run if you would like to see benchmark results.