Trait Visitor

Source
pub trait Visitor<'de>: Sized {
    type Value;

Show 33 methods // Required method fn expecting(&self, formatter: &mut Formatter<'_>) -> Result; // Provided methods fn visit_key<E>(self, key: &str) -> Result<Self::Value, E> where E: Error { ... } fn visit_class_index<A>(self, map: A) -> Result<Self::Value, A::Error> where A: ClassIndexAccess<'de> { ... } fn visit_void<E>(self, _: ()) -> Result<Self::Value, E> where E: Error { ... } fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E> where E: Error { ... } fn visit_char<E>(self, v: char) -> Result<Self::Value, E> where E: Error { ... } fn visit_int8<E>(self, v: i8) -> Result<Self::Value, E> where E: Error { ... } fn visit_uint8<E>(self, v: u8) -> Result<Self::Value, E> where E: Error { ... } fn visit_int16<E>(self, v: i16) -> Result<Self::Value, E> where E: Error { ... } fn visit_uint16<E>(self, v: u16) -> Result<Self::Value, E> where E: Error { ... } fn visit_int32<E>(self, v: i32) -> Result<Self::Value, E> where E: Error { ... } fn visit_uint32<E>(self, v: u32) -> Result<Self::Value, E> where E: Error { ... } fn visit_int64<E>(self, v: i64) -> Result<Self::Value, E> where E: Error { ... } fn visit_uint64<E>(self, v: u64) -> Result<Self::Value, E> where E: Error { ... } fn visit_real<E>(self, v: f32) -> Result<Self::Value, E> where E: Error { ... } fn visit_vector4<E>(self, v: Vector4) -> Result<Self::Value, E> where E: Error { ... } fn visit_quaternion<E>(self, v: Quaternion) -> Result<Self::Value, E> where E: Error { ... } fn visit_matrix3<E>(self, v: Matrix3) -> Result<Self::Value, E> where E: Error { ... } fn visit_rotation<E>(self, v: Rotation) -> Result<Self::Value, E> where E: Error { ... } fn visit_qstransform<E>(self, v: QsTransform) -> Result<Self::Value, E> where E: Error { ... } fn visit_matrix4<E>(self, v: Matrix4) -> Result<Self::Value, E> where E: Error { ... } fn visit_transform<E>(self, v: Transform) -> Result<Self::Value, E> where E: Error { ... } fn visit_pointer<E>(self, v: Pointer) -> Result<Self::Value, E> where E: Error { ... } fn visit_variant<E>(self, v: Variant) -> Result<Self::Value, E> where E: Error { ... } fn visit_array<A>(self, seq: A) -> Result<Self::Value, A::Error> where A: SeqAccess<'de> { ... } fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error> where A: EnumAccess<'de> { ... } fn visit_struct<A>(self, map: A) -> Result<Self::Value, A::Error> where A: MapAccess<'de> { ... } fn visit_struct_for_bytes<A>(self, map: A) -> Result<Self::Value, A::Error> where A: MapAccess<'de> { ... } fn visit_cstring<E>(self, v: CString<'de>) -> Result<Self::Value, E> where E: Error { ... } fn visit_ulong<E>(self, v: Ulong) -> Result<Self::Value, E> where E: Error { ... } fn visit_flags<A>(self, data: A) -> Result<Self::Value, A::Error> where A: EnumAccess<'de> { ... } fn visit_half<E>(self, v: f16) -> Result<Self::Value, E> where E: Error { ... } fn visit_stringptr<E>(self, v: StringPtr<'de>) -> Result<Self::Value, E> where E: Error { ... }
}
Expand description

This trait represents a visitor that walks through a deserializer.

§Lifetime

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

Required Associated Types§

Source

type Value

The value produced by this visitor.

Required Methods§

Source

fn expecting(&self, formatter: &mut Formatter<'_>) -> Result

Format a message stating what data this Visitor expects to receive.

This is used in error messages. The message should complete the sentence “This Visitor expects to receive …”, for example the message could be “an integer between 0 and 64”. The message should not be capitalized and should not end with a period.

fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
    write!(formatter, "an integer between 0 and {}", self.max)
}

Provided Methods§

Source

fn visit_key<E>(self, key: &str) -> Result<Self::Value, E>
where E: Error,

The input contains a MapAccess key.

The default implementation fails with a type error.

Source

fn visit_class_index<A>(self, map: A) -> Result<Self::Value, A::Error>
where A: ClassIndexAccess<'de>,

The input contains a havok class.

The default implementation fails with a type error.

Source

fn visit_void<E>(self, _: ()) -> Result<Self::Value, E>
where E: Error,

The input contains a void.

The default implementation fails with a type error.

Source

fn visit_bool<E>(self, v: bool) -> Result<Self::Value, E>
where E: Error,

The input contains a boolean.

The default implementation fails with a type error.

Source

fn visit_char<E>(self, v: char) -> Result<Self::Value, E>
where E: Error,

The input contains char.

The default implementation fails with a type error.

Source

fn visit_int8<E>(self, v: i8) -> Result<Self::Value, E>
where E: Error,

The input contains a i8.

The default implementation fails with a type error.

Source

fn visit_uint8<E>(self, v: u8) -> Result<Self::Value, E>
where E: Error,

The input contains a u8.

The default implementation fails with a type error.

Source

fn visit_int16<E>(self, v: i16) -> Result<Self::Value, E>
where E: Error,

The input contains a i16.

The default implementation fails with a type error.

Source

fn visit_uint16<E>(self, v: u16) -> Result<Self::Value, E>
where E: Error,

The input contains a u16.

The default implementation fails with a type error.

Source

fn visit_int32<E>(self, v: i32) -> Result<Self::Value, E>
where E: Error,

The input contains a i32.

The default implementation fails with a type error.

Source

fn visit_uint32<E>(self, v: u32) -> Result<Self::Value, E>
where E: Error,

The input contains a u32.

The default implementation fails with a type error.

Source

fn visit_int64<E>(self, v: i64) -> Result<Self::Value, E>
where E: Error,

The input contains a i64.

The default implementation fails with a type error.

Source

fn visit_uint64<E>(self, v: u64) -> Result<Self::Value, E>
where E: Error,

The input contains a u64.

The default implementation fails with a type error.

Source

fn visit_real<E>(self, v: f32) -> Result<Self::Value, E>
where E: Error,

The input contains a f32.

The default implementation fails with a type error.

Source

fn visit_vector4<E>(self, v: Vector4) -> Result<Self::Value, E>
where E: Error,

The input contains a Vector4.

The default implementation fails with a type error.

Source

fn visit_quaternion<E>(self, v: Quaternion) -> Result<Self::Value, E>
where E: Error,

The input contains a Quaternion.

The default implementation fails with a type error.

Source

fn visit_matrix3<E>(self, v: Matrix3) -> Result<Self::Value, E>
where E: Error,

The input contains a Matrix3.

The default implementation fails with a type error.

Source

fn visit_rotation<E>(self, v: Rotation) -> Result<Self::Value, E>
where E: Error,

The input contains a Rotation.

The default implementation fails with a type error.

Source

fn visit_qstransform<E>(self, v: QsTransform) -> Result<Self::Value, E>
where E: Error,

The input contains a QsTransform.

The default implementation fails with a type error.

Source

fn visit_matrix4<E>(self, v: Matrix4) -> Result<Self::Value, E>
where E: Error,

The input contains a Matrix4.

The default implementation fails with a type error.

Source

fn visit_transform<E>(self, v: Transform) -> Result<Self::Value, E>
where E: Error,

The input contains a Transform.

The default implementation fails with a type error.

Source

fn visit_pointer<E>(self, v: Pointer) -> Result<Self::Value, E>
where E: Error,

The input contains a Pointer.

The default implementation fails with a type error.

Source

fn visit_variant<E>(self, v: Variant) -> Result<Self::Value, E>
where E: Error,

The input contains a Variant.

The default implementation fails with a type error.

Source

fn visit_array<A>(self, seq: A) -> Result<Self::Value, A::Error>
where A: SeqAccess<'de>,

The input contains an Array.

The default implementation fails with a type error.

Source

fn visit_enum<A>(self, data: A) -> Result<Self::Value, A::Error>
where A: EnumAccess<'de>,

The input contains an enum.

The default implementation fails with a type error.

Source

fn visit_struct<A>(self, map: A) -> Result<Self::Value, A::Error>
where A: MapAccess<'de>,

The input contains a key-value map.(serde: visit_map)

The default implementation fails with a type error.

§Note

This is a separated method because bytes processing cannot coexist with XML’s SERIALIZE_IGNORED.

Source

fn visit_struct_for_bytes<A>(self, map: A) -> Result<Self::Value, A::Error>
where A: MapAccess<'de>,

The input contains a key-value map.(serde: visit_map)

The default implementation fails with a type error.

§Note

This is a separated method because bytes processing cannot coexist with XML’s SERIALIZE_IGNORED.

Source

fn visit_cstring<E>(self, v: CString<'de>) -> Result<Self::Value, E>
where E: Error,

The input contains a CString.

The default implementation fails with a type error.

Source

fn visit_ulong<E>(self, v: Ulong) -> Result<Self::Value, E>
where E: Error,

The input contains a u64.

The default implementation fails with a type error.

Source

fn visit_flags<A>(self, data: A) -> Result<Self::Value, A::Error>
where A: EnumAccess<'de>,

The input contains flags.

The default implementation fails with a type error.

Source

fn visit_half<E>(self, v: f16) -> Result<Self::Value, E>
where E: Error,

The input contains a f16.

The default implementation fails with a type error.

Source

fn visit_stringptr<E>(self, v: StringPtr<'de>) -> Result<Self::Value, E>
where E: Error,

The input contains a StringPtr.

The default implementation fails with a type error.

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.

Implementors§