- Notifications
You must be signed in to change notification settings - Fork29
Serde
Finn Bear edited this pageMar 22, 2025 ·6 revisions
Aserde
integration is gated behind the"serde"
feature flag. It is slower, producesslightly larger output, and (by extension) is not compatible with the nativebitcode::{Encode, Decode}
.
bitcode
isn't self-describing, so it doesn't supportserde
features that rely on self-description:
enum
's with#[serde(untagged)]
or#[serde(tag = ...)]
.- Fields with
#[serde(skip_serializing_if = ...)]
,#[serde(default)]
, etc. - Types like
serde_json::Value
, which internally serialize different types (numbers, arrays, etc.) without a normal enum discriminant.
- The
serde
version omits theflowinfo
andscope_id
fields ofstd::net::SocketAddrV6
, but thederive
versionkeeps them. - The
serde
version supports recursive types, but thederive
version (as of version0.6
) does not.