Module preserves::set

source ·
Expand description

Serde support for serializing Rust collections as Preserves sets.

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

§Example

Annotate collection-valued fields that you want to (en|de)code as Preserves Sets with #[serde(with = "preserves::set")]:

#[derive(serde::Serialize, serde::Deserialize)]
struct Example {
  #[serde(with = "preserves::set")]
  items: preserves::value::Set<String>,
}