Module preserves::symbol

source ·
Expand description

Serde support for serializing Rust data as Preserves symbols.

Serde doesn’t include symbols in its data model, so we do some somewhat awful tricks to force things to come out the way we want them.

§Example

Either use Symbol directly in your data types, or annotate String-valued fields that you want to (en|de)code as Preserves Symbols with #[serde(with = "preserves::symbol")]:

#[derive(serde::Serialize, serde::Deserialize)]
struct Example {
  sym1: preserves::symbol::Symbol,
  #[serde(with = "preserves::symbol")]
  sym2: String,
}

Structs§

  • Wrapper for a string to coerce its Preserves-serialization to Symbol.