-
Notifications
You must be signed in to change notification settings - Fork 25
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
Tree height and width are f32 but deserialised as Option<f32> #86
Comments
relevant: emilk/egui#5176 |
I think we need to revert |
Either revert it or also handle the serialization the same way:
#[cfg(feature = "serde")]
fn serialize_f32_infinity_as_null<S: serde::Serializer>(
t: &f32,
serializer: S,
) -> Result<S::Ok, S::Error> {
if t.is_infinite() {
serializer.serialize_none()
} else {
serializer.serialize_f32(*t)
}
} Edit based on @lwiklendt's suggestion: #[cfg(feature = "serde")]
fn serialize_f32_as_infinity_as_null<S: serde::Serializer>(
t: &f32,
serializer: S,
) -> Result<S::Ok, S::Error> {
if t.is_infinite() {
serializer.serialize_none()
} else {
serializer.serialize_some(t)
}
} |
The deserialiser is expecting an |
Can JSON just add support for +/-inf already 🙄 |
Wow, TIL JSON doesn't have inf and NaN support. |
|
Tree::height
andTree::width
aref32
but are trying to be deserialised asOption<f32>
resulting in an erroregui_tiles/src/tree.rs
Lines 57 to 62 in 3e7f324
The text was updated successfully, but these errors were encountered: