Open kszlim opened 1 month ago
I'm currently working on such an alternative. It addresses a lot of the outstanding issues on serde-value
.
Cool! I notice that everything is boxed unfortunately, is there any potentially workaround to leave "dense" primitive types unboxed (while preserving nullability)?
Not everything is boxed. Only structs, enums and non-null options. Those are boxed because the type is self-referential in those variants. The internal Serde type is also structured in a similar way.
is there any potentially workaround to leave "dense" primitive types unboxed (while preserving nullability)?
Well, non-optional values are treated as Some(value)
if you deserialise them into an Option
so you can avoid a heap allocation by serialising primitive types directly instead of wrapping them in Some
where possible.
I'm trying to build serde's internal representation directly, and there doesn't seem to be a way to do that via
serde
, thus far, i've been constructing a proxy for that via usingserde_json
types directly. But I'm wondering if there's a more efficient way?serde_value
looks like what I need, but it also looks unmaintained, perhaps it's a "done" crate? I'm looking for any recommendations.