Skip to content
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

Revisit serde features to make them easier to comprehend and work with #405

Open
paupino opened this issue Jul 16, 2021 · 1 comment
Open
Labels
serde-cleanup Clean up serde features

Comments

@paupino
Copy link
Owner

paupino commented Jul 16, 2021

This can likely share some lessons from serde_json, without pulling in the additional dependency.

e.g. Serlialization, look into how this is done.

        serde_json::Number::from_str(&self.to_string())
            .map_err(serde::ser::Error::custom)?
            .serialize(serializer) 

e.g.

        let mut s = serializer.serialize_struct(TOKEN, 1)?;
        s.serialize_field(TOKEN, &self.n)?;
        s.end()

Deserialization would be looking into the arbitrary precision feature.

@paupino paupino added this to the v1.16 milestone Jul 28, 2021
@paupino
Copy link
Owner Author

paupino commented Sep 14, 2021

I think this ticket should encompass a bit more than optimization. We should really start to clean up the behavior and make it easier to comprehend/parse if possible. One proposal is:

  1. Deserialization supports both float (1.234) and string based ("1.234") formats
  2. Serialization format is controlled via feature flag. Default is to use the string based approach however serde-float can be used to serialize float format also.

serde-str should become redundant and serde-arbitrary-precision only necessary if wanting to leverage serde-json precision features (assuming optimization is still a part of this too - i.e. avoiding intermediary floats).

@paupino paupino changed the title Optimize serde-float feature by preventing serialization to/from f64 Revisit serde features to make serde features easier to comprehend and work with Sep 14, 2021
@paupino paupino changed the title Revisit serde features to make serde features easier to comprehend and work with Revisit serde features to make them easier to comprehend and work with Sep 14, 2021
@paupino paupino removed this from the v1.16 milestone Sep 14, 2021
@paupino paupino added the serde-cleanup Clean up serde features label Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
serde-cleanup Clean up serde features
Projects
None yet
Development

No branches or pull requests

1 participant