pub trait Visitor<'de, C: ?Sized + Context>: Sized {
type Ok;
type String: UnsizedVisitor<'de, C, str, Ok = Self::Ok>;
type Bytes: UnsizedVisitor<'de, C, [u8], Ok = Self::Ok>;
Show 25 methods
// Required method
fn expecting(&self, f: &mut Formatter<'_>) -> Result;
// Provided methods
fn visit_empty(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_variant<D>(self, cx: &C, _: &mut D) -> Result<Self::Ok, C::Error>
where D: VariantDecoder<'de, Cx = C> { ... }
fn visit_unknown<D>(self, cx: &D::Cx, _: D) -> Result<Self::Ok, D::Error>
where D: Decoder<'de, Cx = C, Error = C::Error, Mode = C::Mode> { ... }
}
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: UnsizedVisitor<'de, C, str, Ok = Self::Ok>
type String: UnsizedVisitor<'de, C, str, Ok = Self::Ok>
String decoder to use.
Sourcetype Bytes: UnsizedVisitor<'de, C, [u8], Ok = Self::Ok>
type Bytes: UnsizedVisitor<'de, C, [u8], Ok = Self::Ok>
Bytes decoder to use.
Required Methods§
Provided Methods§
Sourcefn visit_empty(self, cx: &C) -> Result<Self::Ok, C::Error>
fn visit_empty(self, cx: &C) -> Result<Self::Ok, C::Error>
Indicates that the visited type is empty.
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_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.
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.