-
Notifications
You must be signed in to change notification settings - Fork 123
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
[Feature] Deserializer: Set Default Numeric Type #520
Comments
I may need some clarification before I'm able to give you a good answer. During serialisation, we always serialise numeric values as-is, and the If I understood you correctly, you want to customise the behaviour of how to parse numeric values when we don't have their suffix and are not sure what numeric type they should be, which is the case when using |
Currently it's possible to specify type suffixes for integers and floats to control what type they serialize to, however, for types without a type suffix the normal behavior of using the smallest numeric type that fits the value.
I would like a way to use a consistent default type for values that specify one, I thought of two ways of achieving that:
ron::options::Options
to control default numeric types. This could look something like this enum or maybe even be a callback that takes a number and returns the ron valueMy use case is using ron as a text format for dbus varients. These are dynamically typed objects that store their types as part of their value, and it makes sense for my use case to default integers to
u32
and floats tof64
.The text was updated successfully, but these errors were encountered: