-
Notifications
You must be signed in to change notification settings - Fork 180
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
Reconsider location for data struct definitions #415
Comments
Last week, we discussed this and decided it is a good idea to distribute the data structs into their individual crates. One catch I discovered: the InvariantDataProvider should be able to construct instances of all of these structs. Options:
I like option 2, because it is the most generalizable, such as people adding new struct definitions outside of code ICU4X. |
I'm strongly in favor of 2 |
OK. I'm not sure where to start on implementing option 2. Does Rust have static initializers or some other way to register functions to be run at startup? Or some way to globally loop through all implementations of a certain trait? |
We could use lazy_static or phf - http://siciarz.net/24-days-rust-static-initialization/ |
2020-12-17: Global registries are just bad; probably don't use one. Consider other options, like generic functions powering the InvariantDataProvider. @sffc to read the blog post linked above. |
When we move the struct definitions, we can also make serde an optional feature on the icu_provider crate. |
With #405, it will no longer be necessary to keep all of the data struct definitions in a common crate. Previously, it was required that all data providers have access to the struct definitions when deserializing data. However, with this no longer the case, we should reconsider this design choice.
The text was updated successfully, but these errors were encountered: