[][src]Module sval::serde::v1

Integration between sval and serde.

Add the serde feature to your Cargo.toml to enable this module:

[dependencies.sval]
features = ["serde"]

From sval to serde

A type that implements Value can be converted into a type that implements serde::Serialize:

let my_serialize = sval::serde::v1::to_serialize(my_value);

When using serde without alloc, there are some limitations on what kinds of sval::Values you can convert into serde::Serializes:

  • Any type that uses map_key_begin, map_value_begin, or seq_elem_begin would require buffering, so will return an error instead in no-std environments.

From serde to sval

A type that implements serde::Serialize can be converted into a type that implements Value:

let my_value = sval::serde::v1::to_value(my_serialize);

Structs

ToSerialize

The result of calling sval::serde::v1::to_serialize.

ToValue

The result of calling sval::serde::v1::to_value.

Functions

serialize

Serialize a Value using the given Serializer.

stream

Stream a Serialize using the given Stream.

to_serialize

Convert a Value into a Serialize.

to_value

Convert a Serialize into a Value.