has anyone made a serde ripoff with support for async? it'd be really nice to be able to context switch between multiple serde contexts.
serde-transcode is cool and all but what if you could serde-transmute. but that's not really possible without async.
As far as I know, the best option for this is to use serde on
Vec<u8>. You can read the data into a
Vec<u8> using async IO, then you can call the serde methods on the
Vec<u8> to parse the data. Similarly, you can serialize values in an
Vec<u8>, then write the bytes using async IO.
If you need to support partial data,
nom has streaming support which can handle byte streams that arrive piecemeal.
so the main thing we'd like to have is
serde_transmute with optional borrowing and no-std.
we can't make it work with no-std because we can't context-switch from a Serialize(r) to a Deserialize(r).
when serializing a struct you have
let x = serializer.serialize_struct(name, n);
but when deserializing you have like
and we can't "pipe" the
serialize_field straight into
next_entry without async.
indeed we can't even switch between them at boundaries, instead having to serialize the whole
Serialize before even touching the
Deserialize. it's such a waste because it prevents applying
ignored_any to the
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.