Trait musli::de::Visitor

source ·
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§

source

type Ok

The value produced by the visitor.

source

type String: ValueVisitor<'de, C, str, Ok = Self::Ok>

String decoder to use.

source

type Bytes: ValueVisitor<'de, C, [u8], Ok = Self::Ok>

Bytes decoder to use.

source

type Number: NumberVisitor<'de, C, Ok = Self::Ok>

Number decoder to use.

Required Methods§

source

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

Format the human-readable message that should occur if the decoder was expecting to decode some specific kind of value.

Provided Methods§

source

fn visit_unit(self, cx: &C) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a unit.

source

fn visit_bool(self, cx: &C, _: bool) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a bool.

source

fn visit_char(self, cx: &C, _: char) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a char.

source

fn visit_u8(self, cx: &C, _: u8) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a u8.

source

fn visit_u16(self, cx: &C, _: u16) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a u16.

source

fn visit_u32(self, cx: &C, _: u32) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a u32.

source

fn visit_u64(self, cx: &C, _: u64) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a u64.

source

fn visit_u128(self, cx: &C, _: u128) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a u128.

source

fn visit_i8(self, cx: &C, _: i8) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a i8.

source

fn visit_i16(self, cx: &C, _: i16) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a i16.

source

fn visit_i32(self, cx: &C, _: i32) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a i32.

source

fn visit_i64(self, cx: &C, _: i64) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a i64.

source

fn visit_i128(self, cx: &C, _: i128) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a i128.

source

fn visit_usize(self, cx: &C, _: usize) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a usize.

source

fn visit_isize(self, cx: &C, _: isize) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a isize.

source

fn visit_f32(self, cx: &C, _: f32) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a f32.

source

fn visit_f64(self, cx: &C, _: f64) -> Result<Self::Ok, C::Error>

Indicates that the visited type is a f64.

source

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>,

Indicates that the visited type is an optional type.

source

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.

source

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.

source

fn visit_string(self, cx: &C, hint: SizeHint) -> Result<Self::String, C::Error>

Indicates that the visited type is string.

source

fn visit_bytes(self, cx: &C, hint: SizeHint) -> Result<Self::Bytes, C::Error>

Indicates that the visited type is bytes.

source

fn visit_number(self, cx: &C) -> Result<Self::Number, C::Error>

Indicates that the visited type is a number.

source

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.

Object Safety§

This trait is not object safe.

Implementors§