-
Notifications
You must be signed in to change notification settings - Fork 174
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
Moving some transliteration datagen logic into the crate #4029
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.
Praise: I like the overall structure of this refactoring. I think RuleCollection
is useful to have available at runtime.
reverse: bool, | ||
visible: bool, |
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.
Nit: Avoid boolean positional arguments because they are not readable at the call site; prefer enums
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 think this can be addressed in later polishing, there's no good place for these enums on the public API right now.
|
||
/// The kind of compile error that occurred. | ||
#[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
enum CompileErrorKind { |
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.
Thought: Not convinced about moving this error out of the error
module
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 type does not exist on the public API, as the RuleCollection
can only return DataError
s as a provider. These errors have log information generated from this type's Debug
implementation, so it really is an implementation detail of RuleCollection
at the moment.
direction: Direction, | ||
id_mapping: &HashMap<String, String>, | ||
) -> Result<(Option<Self>, Option<Self>)> | ||
/// ✨ *Enabled with the `compiled_data` Cargo feature.* |
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.
Question: do we need the stability warning for the impl Trait
return value bounds?
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.
Hmm only if we plan on _unstable
requiring fewer data keys in the future. Do we?
c25c2ab
This adds a
RuleCollection
type to theicu_transliterate
crate (datagen
feature). Users register source rules with a BCP-47 name and a list of aliases on this, and once all required sources have been registered, it can be used as a data provider and on-the-fly (cached) compiles sources to data structs.Datagen is updated to use this, it registers all transliterators in CLDR.
Baked data is removed, as there's no transliteration data in CLDR 43. Clients will be able to use
RuleCollection
as a data provider in 1.3.#3961
#3998
#4056
cc @skius