Generic data structure deserialization framework.
- A type that implements
Deserializeis a data structure that can be deserialized from any data format supported by Serde, and conversely
- A type that implements
Deserializeris a data format that can deserialize any data structure supported by Serde.
Deserialize implementations for many Rust primitive and
standard library types. The complete list is below. All of these can be
deserialized using Serde out of the box.
Additionally, Serde provides a procedural macro called
Deserialize implementations for structs and enums
in your program. See the derive section of the manual for how to use this.
Third-party crates may provide
Deserialize implementations for types
that they expose. For example the
linked-hash-map crate provides a
LinkedHashMap<K, V> type that is deserializable by Serde because the
crate provides an implementation of
Deserialize for it.
A partial list of well-maintained formats is given on the Serde website.
This is a slightly different set of types than what is supported for
serialization. Some types can be serialized by Serde but not deserialized.
One example is
- Primitive types:
- i8, i16, i32, i64, i128, isize
- u8, u16, u32, u64, u128, usize
- f32, f64
- Compound types:
- [T; 0] through [T; 32]
- tuples up to size 16
- Common standard library types:
- Result<T, E>
- Wrapper types:
- Cow<’a, T>
- Rc<T> (if features = [“rc”] is enabled)
- Arc<T> (if features = [“rc”] is enabled)
- Collection types:
- BTreeMap<K, V>
- HashMap<K, V, H>
- HashSet<T, H>
- Zero-copy types:
- FFI types:
- Miscellaneous standard library types:
- Net types:
Building blocks for deserializing basic values using the
An efficient way of discarding data from a deserializer.
Unexpected represents an unexpected invocation of any one of the
A data structure that can be deserialized from any data format supported by Serde.
A data structure that can be deserialized without borrowing any data from the deserializer.
DeserializeSeed is the stateful form of the
Deserialize trait. If you
ever find yourself looking for a way to pass data into a
this trait is the way to do it.
A data format that can deserialize any data structure supported by Serde.
Visitor access to the data of an enum in the input.
Error trait allows
Deserialize implementations to create descriptive
error messages belonging to the
Deserializer against which they are
Expected represents an explanation of what data a
Visitor was expecting
Converts an existing value into a
Deserializer from which other values can
Visitor access to each entry of a map in the input.
Visitor access to each element of a sequence in the input.
VariantAccess is a visitor that is created by the
passed to the
Deserialize to deserialize the content of a particular enum
This trait represents a visitor that walks through a deserializer.