-
Notifications
You must be signed in to change notification settings - Fork 255
Add buffer ctors for properties APIs #7384
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
base: main
Are you sure you want to change the base?
Conversation
dfd72e0 to
2edbe86
Compare
| provider: &(impl icu_provider::buf::BufferProvider + ?Sized), | ||
| ) -> Result<Self, DataError> | ||
| where | ||
| T: EnumeratedProperty + for<'a> serde::Deserialize<'a>, |
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.
the Deserialize impl shouldn't be necessary.
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.
Never mind; CPTs use T's serde impl in human readable mode.
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.
Isn't there a macro that generates the whole impl for you?
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 have generics here.
That's probably how we messed up in the first place, because we couldn't use the macro.
robertbastian
left a comment
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 was not an oversight, it was intentional. properties data markers are more stable than other crates, because each data struct is an enum that we can evolve by adding new variants. this means that we will never need fallback code in a buffer constructor, so we don't need buffer constructors.
|
I don't see the relationship between buffer providers and data struct format fallback. Data struct format fallback is something we can do with buffer providers (and don't need to do with baked), but that's a property of custom providers in general, and it's not their raison d'être. There are at least two use cases for buffer providers in properties. Firstly, a low-memory application may choose to load properties on demand. I think this is a pretty marginal use case since the deserialization code has its own cost, but ... possible. The other one is tailoring/private use: the OP in #7374 cared about that use case in particular. We should have a stable ctor that allows one to load properties off of a buffer provider. Currently you need to use If we are 100% sure that the marker will never change then we could design |
|
In any case this is a new API so let's discuss this in the TC. |
|
Fair enough. |
|
I favor adding |
Fixes the issue found in #7374
This was an oversight when we did new properties.