Crate vicardi

Crate vicardi 

Source
Expand description
logo

Vicardi

jCard (vCard in JSON format) serde serialization and deserialization.

GitHub top language Test CI

§The jCard format

The jCard format is quite simple. A jCard is an arrary with 2 elements:

  • The string “vcard”
  • A nested array with the vCard properties
    • Each element in the array is another array with at least 4 elements:
      • Name (e.g. “fn”)
      • Properties (a string to string map)
      • Value type (e.g. “text”)
      • 1+ values of that property
[
  "vcard",
  [
    ["version", {}, "text", "4.0"],
    ["fn", {}, "text", "Vicardi"],
    ["categories", {}, "text", "rust", "serde"],
    ...
  ]
]

The entire array is represented by the Vcard type. Each property is a Property and it can have 1 or more PropertyValues.

A note on the version property:

The RFC requires that the first element in the array is a version property. At the moment, this crate does not enforce any rules regarding the position or number of version properties. However, the first occurance of the version property is removed from the array during deserialization. The value of the version is stored in the Vcard::version field.

During serialization, the value of Vcard::version is placed at index 0 in the properties array.

Re-exports§

pub use structured::*;

Modules§

structured

Macros§

parameters
Easier Parameters construction.

Structs§

Property
An entry in the jCard.
Vcard
A jCard serde type

Enums§

PropertyValue
A Property::values can either be a single value or an array of values. See an example json representation for each variant.

Type Aliases§

Parameters