musli_core::de

Trait Visitor

Source
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§

Source

type Ok

The value produced by the visitor.

Source

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

String decoder to use.

Source

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

Bytes 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_empty(self, cx: &C) -> Result<Self::Ok, C::Error>

Indicates that the visited type is empty.

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_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.

Source

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

Indicates that the encoding does not support dynamic types.

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§