pub trait Visitor<'de, C: ?Sized + Context>: Sized {
type Ok;
type String: ValueVisitor<'de, C, str, Ok = Self::Ok>;
type Bytes: ValueVisitor<'de, C, [u8], Ok = Self::Ok>;
type Number: NumberVisitor<'de, C, Ok = Self::Ok>;
Show 25 methods
// Required method
fn expecting(&self, f: &mut Formatter<'_>) -> Result;
// Provided methods
fn visit_unit(self, cx: &C) -> Result<Self::Ok, C::Error> { ... }
fn visit_bool(self, cx: &C, _: bool) -> Result<Self::Ok, C::Error> { ... }
fn visit_char(self, cx: &C, _: char) -> Result<Self::Ok, C::Error> { ... }
fn visit_u8(self, cx: &C, _: u8) -> Result<Self::Ok, C::Error> { ... }
fn visit_u16(self, cx: &C, _: u16) -> Result<Self::Ok, C::Error> { ... }
fn visit_u32(self, cx: &C, _: u32) -> Result<Self::Ok, C::Error> { ... }
fn visit_u64(self, cx: &C, _: u64) -> Result<Self::Ok, C::Error> { ... }
fn visit_u128(self, cx: &C, _: u128) -> Result<Self::Ok, C::Error> { ... }
fn visit_i8(self, cx: &C, _: i8) -> Result<Self::Ok, C::Error> { ... }
fn visit_i16(self, cx: &C, _: i16) -> Result<Self::Ok, C::Error> { ... }
fn visit_i32(self, cx: &C, _: i32) -> Result<Self::Ok, C::Error> { ... }
fn visit_i64(self, cx: &C, _: i64) -> Result<Self::Ok, C::Error> { ... }
fn visit_i128(self, cx: &C, _: i128) -> Result<Self::Ok, C::Error> { ... }
fn visit_usize(self, cx: &C, _: usize) -> Result<Self::Ok, C::Error> { ... }
fn visit_isize(self, cx: &C, _: isize) -> Result<Self::Ok, C::Error> { ... }
fn visit_f32(self, cx: &C, _: f32) -> Result<Self::Ok, C::Error> { ... }
fn visit_f64(self, cx: &C, _: f64) -> Result<Self::Ok, C::Error> { ... }
fn visit_option<D>(self, cx: &C, _: Option<D>) -> Result<Self::Ok, C::Error>
where D: Decoder<'de, Cx = C, Error = C::Error, Mode = C::Mode> { ... }
fn visit_sequence<D>(
self,
cx: &C,
decoder: &mut D
) -> Result<Self::Ok, C::Error>
where D: ?Sized + SequenceDecoder<'de, Cx = C> { ... }
fn visit_map<D>(
self,
cx: &C,
decoder: &mut D
) -> Result<Self::Ok, <D::Cx as Context>::Error>
where D: ?Sized + MapDecoder<'de, Cx = C> { ... }
fn visit_string(
self,
cx: &C,
hint: SizeHint
) -> Result<Self::String, C::Error> { ... }
fn visit_bytes(
self,
cx: &C,
hint: SizeHint
) -> Result<Self::Bytes, C::Error> { ... }
fn visit_number(self, cx: &C) -> Result<Self::Number, C::Error> { ... }
fn visit_variant<D>(self, cx: &C, _: &mut D) -> Result<Self::Ok, C::Error>
where D: VariantDecoder<'de, Cx = C> { ... }
}
Expand description
Visitor capable of decoding any type into a value Visitor::Ok
.
Each callback on this visitor indicates the type that should be decoded from the passed in decoder. A typical implementation would simply call the corresponding decoder function for the type being visited.
Required Associated Types§
sourcetype String: ValueVisitor<'de, C, str, Ok = Self::Ok>
type String: ValueVisitor<'de, C, str, Ok = Self::Ok>
String decoder to use.
sourcetype Bytes: ValueVisitor<'de, C, [u8], Ok = Self::Ok>
type Bytes: ValueVisitor<'de, C, [u8], Ok = Self::Ok>
Bytes decoder to use.
sourcetype Number: NumberVisitor<'de, C, Ok = Self::Ok>
type Number: NumberVisitor<'de, C, Ok = Self::Ok>
Number decoder to use.
Required Methods§
Provided Methods§
sourcefn visit_unit(self, cx: &C) -> Result<Self::Ok, C::Error>
fn visit_unit(self, cx: &C) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a unit
.
sourcefn visit_bool(self, cx: &C, _: bool) -> Result<Self::Ok, C::Error>
fn visit_bool(self, cx: &C, _: bool) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a bool
.
sourcefn visit_char(self, cx: &C, _: char) -> Result<Self::Ok, C::Error>
fn visit_char(self, cx: &C, _: char) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a char
.
sourcefn visit_u8(self, cx: &C, _: u8) -> Result<Self::Ok, C::Error>
fn visit_u8(self, cx: &C, _: u8) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a u8
.
sourcefn visit_u16(self, cx: &C, _: u16) -> Result<Self::Ok, C::Error>
fn visit_u16(self, cx: &C, _: u16) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a u16
.
sourcefn visit_u32(self, cx: &C, _: u32) -> Result<Self::Ok, C::Error>
fn visit_u32(self, cx: &C, _: u32) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a u32
.
sourcefn visit_u64(self, cx: &C, _: u64) -> Result<Self::Ok, C::Error>
fn visit_u64(self, cx: &C, _: u64) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a u64
.
sourcefn visit_u128(self, cx: &C, _: u128) -> Result<Self::Ok, C::Error>
fn visit_u128(self, cx: &C, _: u128) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a u128
.
sourcefn visit_i8(self, cx: &C, _: i8) -> Result<Self::Ok, C::Error>
fn visit_i8(self, cx: &C, _: i8) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a i8
.
sourcefn visit_i16(self, cx: &C, _: i16) -> Result<Self::Ok, C::Error>
fn visit_i16(self, cx: &C, _: i16) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a i16
.
sourcefn visit_i32(self, cx: &C, _: i32) -> Result<Self::Ok, C::Error>
fn visit_i32(self, cx: &C, _: i32) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a i32
.
sourcefn visit_i64(self, cx: &C, _: i64) -> Result<Self::Ok, C::Error>
fn visit_i64(self, cx: &C, _: i64) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a i64
.
sourcefn visit_i128(self, cx: &C, _: i128) -> Result<Self::Ok, C::Error>
fn visit_i128(self, cx: &C, _: i128) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a i128
.
sourcefn visit_usize(self, cx: &C, _: usize) -> Result<Self::Ok, C::Error>
fn visit_usize(self, cx: &C, _: usize) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a usize
.
sourcefn visit_isize(self, cx: &C, _: isize) -> Result<Self::Ok, C::Error>
fn visit_isize(self, cx: &C, _: isize) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a isize
.
sourcefn visit_f32(self, cx: &C, _: f32) -> Result<Self::Ok, C::Error>
fn visit_f32(self, cx: &C, _: f32) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a f32
.
sourcefn visit_f64(self, cx: &C, _: f64) -> Result<Self::Ok, C::Error>
fn visit_f64(self, cx: &C, _: f64) -> Result<Self::Ok, C::Error>
Indicates that the visited type is a f64
.
sourcefn visit_option<D>(self, cx: &C, _: Option<D>) -> Result<Self::Ok, C::Error>
fn visit_option<D>(self, cx: &C, _: Option<D>) -> Result<Self::Ok, C::Error>
Indicates that the visited type is an optional type.
sourcefn visit_sequence<D>(
self,
cx: &C,
decoder: &mut D
) -> Result<Self::Ok, C::Error>where
D: ?Sized + SequenceDecoder<'de, Cx = C>,
fn visit_sequence<D>(
self,
cx: &C,
decoder: &mut D
) -> Result<Self::Ok, C::Error>where
D: ?Sized + SequenceDecoder<'de, Cx = C>,
Indicates that the visited type is a sequence.
sourcefn visit_map<D>(
self,
cx: &C,
decoder: &mut D
) -> Result<Self::Ok, <D::Cx as Context>::Error>where
D: ?Sized + MapDecoder<'de, Cx = C>,
fn visit_map<D>(
self,
cx: &C,
decoder: &mut D
) -> Result<Self::Ok, <D::Cx as Context>::Error>where
D: ?Sized + MapDecoder<'de, Cx = C>,
Indicates that the visited type is a map.
sourcefn visit_string(self, cx: &C, hint: SizeHint) -> Result<Self::String, C::Error>
fn visit_string(self, cx: &C, hint: SizeHint) -> Result<Self::String, C::Error>
Indicates that the visited type is string
.
sourcefn visit_bytes(self, cx: &C, hint: SizeHint) -> Result<Self::Bytes, C::Error>
fn visit_bytes(self, cx: &C, hint: SizeHint) -> Result<Self::Bytes, C::Error>
Indicates that the visited type is bytes
.
sourcefn visit_number(self, cx: &C) -> Result<Self::Number, C::Error>
fn visit_number(self, cx: &C) -> Result<Self::Number, C::Error>
Indicates that the visited type is a number.
sourcefn visit_variant<D>(self, cx: &C, _: &mut D) -> Result<Self::Ok, C::Error>where
D: VariantDecoder<'de, Cx = C>,
fn visit_variant<D>(self, cx: &C, _: &mut D) -> Result<Self::Ok, C::Error>where
D: VariantDecoder<'de, Cx = C>,
Indicates that the visited type is a variant.