serde

Trait Deserialize

Source
pub trait Deserialize<'de>: Sized {
    // Required method
    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
       where D: Deserializer<'de>;
}
Expand description

A data structure that can be deserialized from any data format supported by Serde.

Serde provides Deserialize implementations for many Rust primitive and standard library types. The complete list is here. All of these can be deserialized using Serde out of the box.

Additionally, Serde provides a procedural macro called serde_derive to automatically generate Deserialize implementations for structs and enums in your program. See the derive section of the manual for how to use this.

In rare cases it may be necessary to implement Deserialize manually for some type in your program. See the Implementing Deserialize section of the manual for more about 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.

§Lifetime

The 'de lifetime of this trait is the lifetime of data that may be borrowed by Self when deserialized. See the page Understanding deserializer lifetimes for a more detailed explanation of these lifetimes.

Required Methods§

Source

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer.

See the Implementing Deserialize section of the manual for more information about how to implement this method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'de> Deserialize<'de> for IpAddr

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for SocketAddr

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for bool

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for char

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for f32

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for f64

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for i8

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for i16

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for i32

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for i64

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for i128

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for isize

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for u8

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for u16

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for u32

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for u64

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for u128

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for ()

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for usize

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Ipv4Addr

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Ipv6Addr

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for SocketAddrV4

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for SocketAddrV6

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<i8>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<i16>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<i32>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<i64>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<i128>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<isize>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<u8>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<u16>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<u32>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<u64>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<u128>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Saturating<usize>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for Duration

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroI8

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroI16

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroI32

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroI64

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroI128

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroIsize

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroU8

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroU16

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroU32

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroU64

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroU128

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de> Deserialize<'de> for NonZeroUsize

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, Idx> Deserialize<'de> for Range<Idx>
where Idx: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, Idx> Deserialize<'de> for RangeFrom<Idx>
where Idx: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, Idx> Deserialize<'de> for RangeInclusive<Idx>
where Idx: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, Idx> Deserialize<'de> for RangeTo<Idx>
where Idx: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for Bound<T>
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for Option<T>
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 0]

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 1]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 2]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 3]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 4]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 5]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 6]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 7]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 8]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 9]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 10]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 11]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 12]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 13]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 14]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 15]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 16]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 17]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 18]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 19]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 20]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 21]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 22]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 23]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 24]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 25]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 26]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 27]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 28]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 29]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 30]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 31]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for [T; 32]
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for (T₁, T₂, …, Tₙ)
where T: Deserialize<'de>,

This trait is implemented for tuples up to 16 items long.

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for Cell<T>
where T: Deserialize<'de> + Copy,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for PhantomData<T>
where T: ?Sized,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T> Deserialize<'de> for Wrapping<T>
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T, E> Deserialize<'de> for Result<T, E>
where T: Deserialize<'de>, E: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T: Deserialize<'de>> Deserialize<'de> for RefCell<T>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de, T: Deserialize<'de>> Deserialize<'de> for Reverse<T>

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de: 'a, 'a> Deserialize<'de> for &'a str

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Source§

impl<'de: 'a, 'a> Deserialize<'de> for &'a [u8]

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Implementors§

Source§

impl<'de> Deserialize<'de> for IgnoredAny