Trait libspa::pod::deserialize::Visitor
source · pub trait Visitor<'de>: Sized {
type Value;
type ArrayElem;
Show 25 methods
// Provided methods
fn visit_none(&self) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_bool(
&self,
_v: bool
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_int(
&self,
_v: i32
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_long(
&self,
_v: i64
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_float(
&self,
_v: f32
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_double(
&self,
_v: f64
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_string(
&self,
_v: &'de str
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_bytes(
&self,
_v: &'de [u8]
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_rectangle(
&self,
_v: Rectangle
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_fraction(
&self,
_v: Fraction
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_id(
&self,
_v: Id
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_fd(
&self,
_v: Fd
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_struct(
&self,
_struct_deserializer: &mut StructPodDeserializer<'de>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_array(
&self,
_elements: Vec<Self::ArrayElem>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_object(
&self,
_object_deserializer: &mut ObjectPodDeserializer<'de>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_bool(
&self,
_choice: Choice<bool>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_i32(
&self,
_choice: Choice<i32>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_i64(
&self,
_choice: Choice<i64>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_f32(
&self,
_choice: Choice<f32>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_f64(
&self,
_choice: Choice<f64>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_id(
&self,
_choice: Choice<Id>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_rectangle(
&self,
_choice: Choice<Rectangle>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_fraction(
&self,
_choice: Choice<Fraction>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_choice_fd(
&self,
_choice: Choice<Fd>
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
fn visit_pointer(
&self,
_type: u32,
_pointer: *const c_void
) -> Result<Self::Value, DeserializeError<&'de [u8]>> { ... }
}
Expand description
This trait represents a visitor is “driven” by the deserializer to construct an instance of your type.
Required Associated Types§
sourcetype ArrayElem
type ArrayElem
The element type Visitor::visit_array
is expecting as input.
Only used for visitors implementing this method,
std::convert::Infallible
can be used as a default.
Provided Methods§
sourcefn visit_none(&self) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_none(&self) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a none
.
sourcefn visit_bool(
&self,
_v: bool
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_bool( &self, _v: bool ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a bool
.
sourcefn visit_int(&self, _v: i32) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_int(&self, _v: i32) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an i32
.
sourcefn visit_long(
&self,
_v: i64
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_long( &self, _v: i64 ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an i64
.
sourcefn visit_float(
&self,
_v: f32
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_float( &self, _v: f32 ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an f32
.
sourcefn visit_double(
&self,
_v: f64
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_double( &self, _v: f64 ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an f64
.
sourcefn visit_string(
&self,
_v: &'de str
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_string( &self, _v: &'de str ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a string.
sourcefn visit_bytes(
&self,
_v: &'de [u8]
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_bytes( &self, _v: &'de [u8] ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a bytes array.
sourcefn visit_rectangle(
&self,
_v: Rectangle
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_rectangle( &self, _v: Rectangle ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a Rectangle
.
sourcefn visit_fraction(
&self,
_v: Fraction
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_fraction( &self, _v: Fraction ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a Fraction
.
sourcefn visit_id(&self, _v: Id) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_id(&self, _v: Id) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an Id
.
sourcefn visit_fd(&self, _v: Fd) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_fd(&self, _v: Fd) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an Fd
.
sourcefn visit_struct(
&self,
_struct_deserializer: &mut StructPodDeserializer<'de>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_struct( &self, _struct_deserializer: &mut StructPodDeserializer<'de> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a structure.
sourcefn visit_array(
&self,
_elements: Vec<Self::ArrayElem>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_array( &self, _elements: Vec<Self::ArrayElem> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an array.
sourcefn visit_object(
&self,
_object_deserializer: &mut ObjectPodDeserializer<'de>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_object( &self, _object_deserializer: &mut ObjectPodDeserializer<'de> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an object.
sourcefn visit_choice_bool(
&self,
_choice: Choice<bool>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_bool( &self, _choice: Choice<bool> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an i32
choice.
sourcefn visit_choice_i32(
&self,
_choice: Choice<i32>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_i32( &self, _choice: Choice<i32> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an i32
choice.
sourcefn visit_choice_i64(
&self,
_choice: Choice<i64>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_i64( &self, _choice: Choice<i64> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains an i64
choice.
sourcefn visit_choice_f32(
&self,
_choice: Choice<f32>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_f32( &self, _choice: Choice<f32> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a f32
choice.
sourcefn visit_choice_f64(
&self,
_choice: Choice<f64>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_f64( &self, _choice: Choice<f64> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a f64
choice.
sourcefn visit_choice_id(
&self,
_choice: Choice<Id>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_id( &self, _choice: Choice<Id> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a Id
choice.
sourcefn visit_choice_rectangle(
&self,
_choice: Choice<Rectangle>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_rectangle( &self, _choice: Choice<Rectangle> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a Rectangle
choice.
sourcefn visit_choice_fraction(
&self,
_choice: Choice<Fraction>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_fraction( &self, _choice: Choice<Fraction> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a Fraction
choice.
sourcefn visit_choice_fd(
&self,
_choice: Choice<Fd>
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_choice_fd( &self, _choice: Choice<Fd> ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a Fd
choice.
sourcefn visit_pointer(
&self,
_type: u32,
_pointer: *const c_void
) -> Result<Self::Value, DeserializeError<&'de [u8]>>
fn visit_pointer( &self, _type: u32, _pointer: *const c_void ) -> Result<Self::Value, DeserializeError<&'de [u8]>>
The input contains a pointer.