Trait serde::de::Visitor
[−]
[src]
pub trait Visitor { type Value: Deserialize; fn visit_bool<E>(&mut self, v: bool) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_isize<E>(&mut self, v: isize) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_i8<E>(&mut self, v: i8) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_i16<E>(&mut self, v: i16) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_i32<E>(&mut self, v: i32) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_i64<E>(&mut self, v: i64) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_usize<E>(&mut self, v: usize) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_u8<E>(&mut self, v: u8) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_u16<E>(&mut self, v: u16) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_u32<E>(&mut self, v: u32) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_u64<E>(&mut self, v: u64) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_f32<E>(&mut self, v: f32) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_f64<E>(&mut self, v: f64) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_char<E>(&mut self, v: char) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_str<E>(&mut self, v: &str) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_string<E>(&mut self, v: String) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_unit<E>(&mut self) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_unit_struct<E>(
&mut self,
name: &'static str
) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_none<E>(&mut self) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_some<D>(
&mut self,
deserializer: &mut D
) -> Result<Self::Value, D::Error>
where
D: Deserializer, { ... } fn visit_newtype_struct<D>(
&mut self,
deserializer: &mut D
) -> Result<Self::Value, D::Error>
where
D: Deserializer, { ... } fn visit_seq<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error>
where
V: SeqVisitor, { ... } fn visit_map<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error>
where
V: MapVisitor, { ... } fn visit_bytes<E>(&mut self, v: &[u8]) -> Result<Self::Value, E>
where
E: Error, { ... } fn visit_byte_buf<E>(&mut self, v: Vec<u8>) -> Result<Self::Value, E>
where
E: Error, { ... } }
This trait represents a visitor that walks through a deserializer.
Associated Types
type Value: Deserialize
The value produced by this visitor.
Provided Methods
fn visit_bool<E>(&mut self, v: bool) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_bool
deserializes a bool
into a Value
.
fn visit_isize<E>(&mut self, v: isize) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_isize
deserializes a isize
into a Value
.
fn visit_i8<E>(&mut self, v: i8) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_i8
deserializes a i8
into a Value
.
fn visit_i16<E>(&mut self, v: i16) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_i16
deserializes a i16
into a Value
.
fn visit_i32<E>(&mut self, v: i32) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_i32
deserializes a i32
into a Value
.
fn visit_i64<E>(&mut self, v: i64) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_i64
deserializes a i64
into a Value
.
fn visit_usize<E>(&mut self, v: usize) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_usize
deserializes a usize
into a Value
.
fn visit_u8<E>(&mut self, v: u8) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_u8
deserializes a u8
into a Value
.
fn visit_u16<E>(&mut self, v: u16) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_u16
deserializes a u16
into a Value
.
fn visit_u32<E>(&mut self, v: u32) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_u32
deserializes a u32
into a Value
.
fn visit_u64<E>(&mut self, v: u64) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_u64
deserializes a u64
into a Value
.
fn visit_f32<E>(&mut self, v: f32) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_f32
deserializes a f32
into a Value
.
fn visit_f64<E>(&mut self, v: f64) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_f64
deserializes a f64
into a Value
.
fn visit_char<E>(&mut self, v: char) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_char
deserializes a char
into a Value
.
fn visit_str<E>(&mut self, v: &str) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_str
deserializes a &str
into a Value
.
fn visit_string<E>(&mut self, v: String) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_string
deserializes a String
into a Value
. This allows a deserializer to avoid
a copy if it is deserializing a string from a String
type. By default it passes a &str
to the visit_str
method.
fn visit_unit<E>(&mut self) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_unit
deserializes a ()
into a Value
.
fn visit_unit_struct<E>(&mut self, name: &'static str) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_unit_struct
deserializes a unit struct into a Value
.
fn visit_none<E>(&mut self) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_none
deserializes a none value into a Value
.
fn visit_some<D>(
&mut self,
deserializer: &mut D
) -> Result<Self::Value, D::Error> where
D: Deserializer,
&mut self,
deserializer: &mut D
) -> Result<Self::Value, D::Error> where
D: Deserializer,
visit_some
deserializes a value into a Value
.
fn visit_newtype_struct<D>(
&mut self,
deserializer: &mut D
) -> Result<Self::Value, D::Error> where
D: Deserializer,
&mut self,
deserializer: &mut D
) -> Result<Self::Value, D::Error> where
D: Deserializer,
visit_newtype_struct
deserializes a value into a Value
.
fn visit_seq<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error> where
V: SeqVisitor,
V: SeqVisitor,
visit_seq
deserializes a SeqVisitor
into a Value
.
fn visit_map<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error> where
V: MapVisitor,
V: MapVisitor,
visit_map
deserializes a MapVisitor
into a Value
.
fn visit_bytes<E>(&mut self, v: &[u8]) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_bytes
deserializes a &[u8]
into a Value
.
fn visit_byte_buf<E>(&mut self, v: Vec<u8>) -> Result<Self::Value, E> where
E: Error,
E: Error,
visit_byte_buf
deserializes a Vec<u8>
into a Value
.
Implementors
impl Visitor for ByteBufVisitor type Value = ByteBuf;
impl Visitor for UnitVisitor type Value = ();
impl Visitor for BoolVisitor type Value = bool;
impl<T> Visitor for PhantomDataVisitor<T> type Value = PhantomData<T>;
impl<T> Visitor for BinaryHeapVisitor<T> where
T: Deserialize + Ord, type Value = BinaryHeap<T>;impl<T> Visitor for BTreeSetVisitor<T> where
T: Deserialize + Eq + Ord, type Value = BTreeSet<T>;impl<T> Visitor for LinkedListVisitor<T> where
T: Deserialize, type Value = LinkedList<T>;impl<T, S> Visitor for HashSetVisitor<T, S> where
T: Deserialize + Eq + Hash,
S: BuildHasher + Default, type Value = HashSet<T, S>;impl<T> Visitor for VecVisitor<T> where
T: Deserialize, type Value = Vec<T>;impl<T> Visitor for VecDequeVisitor<T> where
T: Deserialize, type Value = VecDeque<T>;impl<T0: Deserialize> Visitor for TupleVisitor1<T0> type Value = (T0,);
impl<T0: Deserialize, T1: Deserialize> Visitor for TupleVisitor2<T0, T1> type Value = (T0, T1);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize> Visitor for TupleVisitor3<T0, T1, T2> type Value = (T0, T1, T2);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize> Visitor for TupleVisitor4<T0, T1, T2, T3> type Value = (T0, T1, T2, T3);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize> Visitor for TupleVisitor5<T0, T1, T2, T3, T4> type Value = (T0, T1, T2, T3, T4);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize> Visitor for TupleVisitor6<T0, T1, T2, T3, T4, T5> type Value = (T0, T1, T2, T3, T4, T5);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize> Visitor for TupleVisitor7<T0, T1, T2, T3, T4, T5, T6> type Value = (T0, T1, T2, T3, T4, T5, T6);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize> Visitor for TupleVisitor8<T0, T1, T2, T3, T4, T5, T6, T7> type Value = (T0, T1, T2, T3, T4, T5, T6, T7);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize> Visitor for TupleVisitor9<T0, T1, T2, T3, T4, T5, T6, T7, T8> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize> Visitor for TupleVisitor10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize, T10: Deserialize> Visitor for TupleVisitor11<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize, T10: Deserialize, T11: Deserialize> Visitor for TupleVisitor12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize, T10: Deserialize, T11: Deserialize, T12: Deserialize> Visitor for TupleVisitor13<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize, T10: Deserialize, T11: Deserialize, T12: Deserialize, T13: Deserialize> Visitor for TupleVisitor14<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize, T10: Deserialize, T11: Deserialize, T12: Deserialize, T13: Deserialize, T14: Deserialize> Visitor for TupleVisitor15<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14);
impl<T0: Deserialize, T1: Deserialize, T2: Deserialize, T3: Deserialize, T4: Deserialize, T5: Deserialize, T6: Deserialize, T7: Deserialize, T8: Deserialize, T9: Deserialize, T10: Deserialize, T11: Deserialize, T12: Deserialize, T13: Deserialize, T14: Deserialize, T15: Deserialize> Visitor for TupleVisitor16<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> type Value = (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15);
impl<K, V> Visitor for BTreeMapVisitor<K, V> where
K: Deserialize + Ord,
V: Deserialize, type Value = BTreeMap<K, V>;impl<K, V, S> Visitor for HashMapVisitor<K, V, S> where
K: Deserialize + Eq + Hash,
V: Deserialize,
S: BuildHasher + Default, type Value = HashMap<K, V, S>;