Skip to main content

Module value

Module value 

Source
Expand description

The Value type.

Values are an anonymous bag of data that can be formatted or serialized. The basic data model of values includes:

  • Null.
  • Booleans.
  • Integers.
  • Binary floating point numbers.
  • Strings.
  • Errors.
  • Sequences.

The data model is enhanced through serialization frameworks like serde or sval to also support:

  • Maps.
  • Structs.
  • Tuples.
  • Enums.

Values are captured using a trait they implement, such as fmt::Display, or serde::Serialize. They can then be serialized using any trait supported by Value. The choice depends on the needs of the consumer, but they don’t need to use the same trait as the producer did.

Structs§

OwnedValue
An owned Value that can be cloned and shared.
Value
An anonymous captured value that can be serialized or formatted.

Traits§

FromValue
Convert from a Value.
ToValue
Convert a reference to a Value.