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

[Feature] Coresponding Serializer for Box<RawValue> #1043

Open
oxalica opened this issue Jul 23, 2023 · 0 comments
Open

[Feature] Coresponding Serializer for Box<RawValue> #1043

oxalica opened this issue Jul 23, 2023 · 0 comments

Comments

@oxalica
Copy link

oxalica commented Jul 23, 2023

RawValue is just a pre-serialized string and should be considered a data format just like Value. Currently the only way to construct Box<RawValue> is through serde_json::value::to_raw_value. It is difficult to write functions using intermediate types to be general over Box<RawValue> and Value, while allowing serializing arbitrary impl Serialize into it.

Thus I propose to have a struct RawSerializer: Serializer<Ok = Box<RawValue>> similar to serde_json::value::Serializer. So we can have fn func<IntermRepr: Serializer> with func::<value::RawSerializer> and func::<value::Serializer>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant