serde 0.5.0

A generic serialization/deserialization framework
b0VIM 7.4ظ�Uu���ericktErick-Tryzelaar-MBP.local~erickt/projects/rust/serde/serde/serde/src/de/mod.rsutf-8
3210#"! Utp	inj=�	0+E
gq~�VL]ad�i�����ihV43�����`_G
�
�
�
�
U
T
���-���7�
w

�	�	�	�	s	+			��bHB& ��nTN2,+���f`D>=���vpTNM�����d^]
����tnm
����zy'��    fn vi    fn visit_i8<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `i8` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_isize<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `isize` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_u64<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `u64` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_u32<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `u32` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_u16<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `u16` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_u8<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `u8` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_usize<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `usize` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_bool<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting a `bool` value.        where V: Visitor;    fn visit<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    /// This method walks a visitor through a value as it is being deserialized.    type Error: Error;pub trait Deserializer {///    `json::Value`-esque type.///    supporting the `visit_*` types is that it does not allow for deserializing into a generic///    the `visit_*` methods how it should parse the next value. One downside though to only///    it's values. It relies instead on the `Deserialize` type to hint to the `Deserializer` with/// 2) The `visit_*` methods. File formats like bincode do not embed in it's format how to decode//////    `json::Value`, which can represent all JSON types.///    format. This allows the `Deserializer` to deserialize into a generic type like/// 1) The `visit` method. File formats like JSON embed the type of it's construct in it's file////// value. It supports two entry point styles which enables different kinds of deserialization./// `Deserializer` is a trait that can deserialize values by threading a `Visitor` trait through a///////////////////////////////////////////////////////////////////////////////}        where D: Deserializer;    fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error>    /// Deserialize this value given this `Deserializer`.pub trait Deserialize {///////////////////////////////////////////////////////////////////////////////}    fn missing_field(field: &'static str) -> Self;    fn unknown_field(field: &str) -> Self;    fn end_of_stream() -> Self;    fn syntax(msg: &str) -> Self;pub trait Error {///////////////////////////////////////////////////////////////////////////////pub mod value;pub mod impls;//! Generic deserialization framework.ad��L����O.���qkj�
�

f
`
(
"
 

����icB<;������`ZY8�
�
�
�
�
�
b
-
�	�	�	�	�	�	�	G	F	+			����baF65���}        where V: MapVisitor;    fn visit<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error>    type Value;pub trait EnumMapVisitor {///////////////////////////////////////////////////////////////////////////////}        where V: SeqVisitor;    fn visit<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error>    type Value;pub trait EnumSeqVisitor {///////////////////////////////////////////////////////////////////////////////}    }        (**self).visit_struct(fields, visitor)    {        where V: Visitor,                    visitor: V) -> Result<V::Value, T::Error>                    fields: &'static [&'static str],    fn visit_struct<V>(&mut self,    }        (**self).visit_tuple(len, visitor)    {        where V: Visitor,                      visitor: V) -> Result<V::Value, T::Error>                      len: usize,    fn visit_tuple<V>(&mut self,    }        (**self).visit_newtype()    {        where D: Deserialize,    fn visit_newtype<D>(&mut self) -> Result<D, T::Error>    }        (**self).visit_unit()    fn visit_unit(&mut self) -> Result<(), T::Error> {    }        (**self).visit_variant()    {        where V: Deserialize    fn visit_variant<V>(&mut self) -> Result<V, T::Error>    type Error = T::Error;impl<'a, T> VariantVisitor for &'a mut T where T: VariantVisitor {}    }        Err(Error::syntax("expected a struct variant"))    {        where V: Visitor                       _visitor: V) -> Result<V::Value, Self::Error>                       _fields: &'static [&'static str],    fn visit_struct<V>(&mut self,    /// `visit_struct` is called when deserializing a struct-like variant.    }        Err(Error::syntax("expected a tuple variant"))    {        where V: Visitor                      _visitor: V) -> Result<V::Value, Self::Error>                      _len: usize,    fn visit_tuple<V>(&mut self,    /// `visit_tuple` is called when deserializing a tuple-like variant.    }        Ok(value)        let (value,) = try!(self.visit_tuple(1, impls::TupleVisitor1::new()));ad4n�����j\�����zl �
�
�
�
|
0


�����A'!����R82�
�
a
G
A
%


�	�	q	W	Q	5	/	.	��|b\<65���lfJDC�B4������A����}a[Z���[A;�n`9                            _name: &'static str,    fn visit_unit_struct<V>(&mut self,    #[inline]    /// deserializers to a unit struct that aren't tagged as a unit struct.    /// This method hints that the `Deserialize` type is expecting a unit struct. This allows    }        self.visit(visitor)    {        where V: Visitor,    fn visit_map<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// deserializers to parse sequences that aren't tagged as maps.    /// This method hints that the `Deserialize` type is expecting a map of values. This allows    }        self.visit(visitor)    {        where V: Visitor,    fn visit_seq<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// deserializers to parse sequences that aren't tagged as sequences.    /// This method hints that the `Deserialize` type is expecting a sequence value. This allows    }        self.visit(visitor)    {        where V: Visitor,    fn visit_option<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// into a `None`, and a regular value as `Some(value)`.    /// deserializers that encode an optional value as a nullable value to convert the null value    /// This method hints that the `Deserialize` type is expecting an `Option` value. This allows    }        self.visit(visitor)    {        where V: Visitor,    fn visit_unit<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `unit` value.    }        self.visit_str(visitor)    {        where V: Visitor,    fn visit_string<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting a `String` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_str<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting a `&str` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_char<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting a `char` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_f64<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting a `f64` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_f32<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting a `f32` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_i64<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `i64` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_i32<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `i32` value.    }        self.visit(visitor)    {        where V: Visitor,    fn visit_i16<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// This method hints that the `Deserialize` type is expecting an `i16` value.    }        self.visit(visitor)    {        where V: Visitor,ad��=���vpo���Q�
�
�
�
�
M

���r(����<.�
�
c
I
C
#


�	\	N	������N�����M
�����a����{uUON��~\QKIH������icF@?������u]W60/����    {        where E: Error,    fn visit_i16<E>(&mut self, v: i16) -> Result<Self::Value, E>    }        self.visit_i64(v as i64)    {        where E: Error,    fn visit_i8<E>(&mut self, v: i8) -> Result<Self::Value, E>    }        self.visit_i64(v as i64)    {        where E: Error,    fn visit_isize<E>(&mut self, v: isize) -> Result<Self::Value, E>    }        Err(Error::syntax())    {        where E: Error,    fn visit_bool<E>(&mut self, _v: bool) -> Result<Self::Value, E>    type Value: Deserialize;pub trait Visitor {///////////////////////////////////////////////////////////////////////////////}    }        ""    fn format() -> &'static str {    /// deserializer.    /// specific field attributes should be used with the    /// The deserializer format is used to determine which format    ///    /// Specify a format string for the deserializer.    }        self.visit_seq(visitor)    {        where V: Visitor,    fn visit_bytes<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// type.    /// deserializers that provide a custom byte vector serialization to properly deserialize the    /// This method hints that the `Deserialize` type is expecti        Err(Error::syn        Err(Error::syntax("expected an enum"))    {        where V: EnumVisitor,                     _visitor: V) -> Result<V::Value, Self::Error>                     _variants: &'static [&'static str],                     _enum: &'static str,    fn visit_enum<V>(&mut self,    #[inline]    /// type.    /// deserializers that provide a custom enumeration serialization to properly deserialize the    /// This method hints that the `Deserialize` type is expecting an enum value. This allows    }        self.visit_seq(visitor)    {        where V: Visitor,    fn visit_tuple<V>(&mut self, _len: usize, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// deserializers that provide a custom tuple serialization to properly deserialize the type.    /// This method hints that the `Deserialize` type is expecting a tuple value. This allows    }        self.visit_map(visitor)    {        where V: Visitor,                       visitor: V) -> Result<V::Value, Self::Error>                       _fields: &'static [&'static str],                       _name: &'static str,    fn visit_struct<V>(&mut self,    #[inline]    /// deserializers to parse sequences that aren't tagged as maps.    /// This method hints that the `Deserialize` type is expecting a struct. This allows    }        self.visit_tuple(len, visitor)    {        where V: Visitor,                             visitor: V) -> Result<V::Value, Self::Error>                             len: usize,                             _name: &'static str,    fn visit_tuple_struct<V>(&mut self,    #[inline]    /// deserializers to parse sequences that aren't tagged as sequences.    /// This method hints that the `Deserialize` type is expecting a tuple struct. This allows    }        self.visit_tuple_struct(name, 1, visitor)    {        where V: Visitor,                               visitor: V) -> Result<V::Value, Self::Error>                               name: &'static str,    fn visit_newtype_struct<V>(&mut self,    #[inline]    /// deserializers to a newtype struct that aren't tagged as a newtype struct.    /// This method hints that the `Deserialize` type is expecting a newtype struct. This allows    }        self.visit_unit(visitor)    {        where V: Visitor,                            visitor: V) -> Result<V::Value, Self::Error>adJ+����yXRQ�����x`Z932�
�
�
�
�
�
l
T
N
-
'
&
������]E?�������C+%�
�
�
�
2
�	�	�	�	}	e	_	B	<	;	-	������lTN1+*������M5/���qkj�����rUO2,+������Q93�������10���srd�    #[inline]    fn end(&mut self) -> Result<(), Self::Error>;        where T: Deserialize;    fn visit<T>(&mut self) -> Result<Option<T>, Self::Error>    type Error: Error;pub trait SeqVisitor {///////////////////////////////////////////////////////////////////////////////}    }        self.visit_bytes(&v)    {        where E: Error,    fn visit_byte_buf<E>(&mut self, v: Vec<u8>) -> Result<Self::Value, E>    }        Err(Error::syntax())    {        where E: Error,    fn visit_bytes<E>(&mut self, _v: &[u8]) -> Result<Self::Value, E>    }        Err(Error::syntax())    {        where V: MapVisitor,    fn visit_map<V>(&mut self, _visitor: V) -> Result<Self::Value, V::Error>    }        Err(Error::syntax())    {        where V: SeqVisitor,    fn visit_seq<V>(&mut self, _visitor: V) -> Result<Self::Value, V::Error>    }        Err(Error::syntax())    {        where D: Deserializer,    fn visit_newtype_struct<D>(&mut self, _deserializer: &mut D) -> Result<Self::Value, D::Error>    }        Err(Error::syntax())    {        where D: Deserializer,    fn visit_some<D>(&mut self, _deserializer: &mut D) -> Result<Self::Value, D::Error>    }        Err(Error::syntax())    {        where E: Error,    fn visit_none<E>(&mut self) -> Result<Self::Value, E>    }        self.visit_unit()    {        where E: Error,    fn visit_unit_struct<E>(&mut self, _name: &'static str) -> Result<Self::Value, E>    #[inline]    }        Err(Error::syntax())    {        where E: Error,    fn visit_unit<E>(&mut self) -> Result<Self::Value, E>    }        self.visit_str(&v)    {        where E: Error,    fn visit_string<E>(&mut self, v: String) -> Result<Self::Value, E>    #[inline]    }        Err(Error::syntax())    {        where E: Error,    fn visit_str<E>(&mut self, _v: &str) -> Result<Self::Value, E>    }        self.visit_string(v.to_string())        // doesn't support encoding a `char` into a stack buffer.        // FIXME: this allocation is required in order to be compatible with stable rust, which    {        where E: Error,    fn visit_char<E>(&mut self, v: char) -> Result<Self::Value, E>    #[inline]    }        Err(Error::syntax())    {        where E: Error,    fn visit_f64<E>(&mut self, _v: f64) -> Result<Self::Value, E>    }        self.visit_f64(v as f64)    {        where E: Error,    fn visit_f32<E>(&mut se        Err(Error::syntax("expected a u64"))        Err(Error::syntax("expected a u64"))    {        where E: Error,    fn visit_u64<E>(&mut self, _v: u64) -> Result<Self::Value, E>    }        self.visit_u64(v as u64)    {        where E: Error,    fn visit_u32<E>(&mut self, v: u32) -> Result<Self::Value, E>    }        self.visit_u64(v as u64)    {        where E: Error,    fn visit_u16<E>(&mut self, v: u16) -> Result<Self::Value, E>    }        self.visit_u64(v as u64)    {        where E: Error,    fn visit_u8<E>(&mut self, v: u8) -> Result<Self::Value, E>    }        self.visit_u64(v as u64)    {        where E: Error,    fn visit_usize<E>(&mut self, v: usize) -> Result<Self::Value, E>    }        Err(Error::syntax("expected a i64"))    {        where E: Error,    fn visit_i64<E>(&mut self, _v: i64) -> Result<Self::Value, E>    }        self.visit_i64(v as i64)    {        where E: Error,    fn visit_i32<E>(&mut self, v: i32) -> Result<Self::Value, E>    }        self.visit_i64(v as i64)ad-A~�����v[ZL�������ztse1�
�
�
�
�
}
8

����~WI,"����ba/. �
�
�
�
�
c
]
4
.
,
+
�	�	�	�		a	C	=	$				������{B%��������Z=754���[C32����vu����Y���wA$G���X:4?    {        where T: Deserialize,    fn visit_newtype<T>(&mut self) -> Result<T, Self::Error>    #[inline]    /// uses the `visit_tuple` method to deserialize the value.    /// `visit_newtype` is called when deserializing a variant wi        Err(Error::syntax("ex        Err(Error::syntax("expected a univ variant"))    fn visit_unit(&mut self) -> Result<(), Self::Error> {    /// `visit_unit` is called when deserializing a variant with no values.        where V: Deserialize;    fn visit_variant<V>(&mut self) -> Result<V, Self::Error>    /// `visit_variant` is called to identify which variant to deserialize.    type Error: Error;pub trait VariantVisitor {/// `Deserialize` in order to deserialize a specific enum variant./// `VariantVisitor` is a visitor that is created by the `Deserializer` and passed to the///////////////////////////////////////////////////////////////////////////////}        where V: VariantVisitor;    fn visit<V>(&mut self, visitor: V) -> Result<Self::Value, V::Error>    type Value;pub trait EnumVisitor {/// `Deserializer` in order to deserialize enums./// `EnumVisitor` is a visitor that is created by the `Deserialize` and passed to the///////////////////////////////////////////////////////////////////////////////}    }        (**self).size_hint()    fn size_hint(&self) -> (usize, Option<usize>) {    #[inline]    }        (**self).end()    fn end(&mut self) -> Result<(), V_::Error> {    #[inline]    }        (**self).visit_value()    {        where V: Deserialize    fn visit_value<V>(&mut self) -> Result<V, V_::Error>    #[inline]    }        (**self).visit_key()    {        where K: Deserialize    fn visit_key<K>(&mut self) -> Result<Option<K>, V_::Error>    #[inline]    }        (**self).visit()    {              V: Deserialize,        where K: Deserialize,    fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, V_::Error>    #[inline]    type Error = V_::Error;impl<'a, V_> MapVisitor for &'a mut V_ where V_: MapVisitor {}    }        Err(Error::missing_field(field))    {        where V: Deserialize,    fn missing_field<V>(&mut self, field: &'static str) -> Result<V, Self::Error>    }        (0, None)    fn size_hint(&self) -> (usize, Option<usize>) {    #[inline]    fn end(&mut self) -> Result<(), Self::Error>;        where V: Deserialize;    fn visit_value<V>(&mut self) -> Result<V, Self::Error>        where K: Deserialize;    fn visit_key<K>(&mut self) -> Result<Option<K>, Self::Error>    }        }            None => Ok(None)            }                Ok(Some((key, value)))                let value = try!(self.visit_value());            Some(key) => {        match try!(self.visit_key()) {    {              V: Deserialize,        where K: Deserialize,    fn visit<K, V>(&mut self) -> Result<Option<(K, V)>, Self::Error>    #[inline]    type Error: Error;pub trait MapVisitor {///////////////////////////////////////////////////////////////////////////////}    }        (**self).size_hint()    fn size_hint(&self) -> (usize, Option<usize>) {    #[inline]    }        (**self).end()    fn end(&mut self) -> Result<(), V::Error> {    #[inline]    }        (**self).visit()    {        where T: Deserialize    fn visit<T>(&mut self) -> Result<Option<T>, V::Error>    #[inline]    type Error = V::Error;impl<'a, V> SeqVisitor for &'a mut V where V: SeqVisitor {}    }        (0, None)    fn size_hint(&self) -> (usize, Option<usize>) {ad�����UG
��    {        where T: Deserialize,    fn visit_newtype<T>(&mut self) -> Result<T, Self::Error>    #[inline]    /// uses the `visit_tuple` method to deserialize the value.    /// `visit_newtype` is called when deserializing a variant with a single value. By default this    }ad
�
0���;-������TL
�
�
�
�
�
�
�
4
3



���qkj%
������a[Z�
    {        where E: Error,    fn visit_i16<E>(&mut self, v: i16) -> Result<Self::Value, E>    }        self.visit_i64(v as i64)    {        where E: Error,    fn visit_i8<E>(&mut self, v: i8) -> Result<Self::Value, E>    }        self.visit_i64(v as i64)    {        where E: Error,    fn visit_isize<E>(&mut self, v: isize) -> Result<Self::Value, E>    }        Err(Error::syntax("expected a bool"))    {        where E: Error,    fn visit_bool<E>(&mut self, _v: bool) -> Result<Self::Value, E>    type Value: Deserialize;pub trait Visitor {///////////////////////////////////////////////////////////////////////////////}    }        ""    fn format() -> &'static str {    /// deserializer.    /// specific field attributes should be used with the    /// The deserializer format is used to determine which format    ///    /// Specify a format string for the deserializer.    }        self.visit_seq(visitor)    {        where V: Visitor,    fn visit_bytes<V>(&mut self, visitor: V) -> Result<V::Value, Self::Error>    #[inline]    /// type.    /// deserializers that provide a custom byte vector serialization to properly deserialize the    /// This method hints that the `Deserialize` type is expecting a `Vec<u8>`. This allows    }ad��g�����ysr0�����uo�
�
�
�
Z
B
<

	

����zts9!�����jdJDC	�
�
�
�
�
U
6
0
�	�	�	�	q	k	3	-	,	������6�����{LFE�������gfO87������        #[inline]    fn end(&mut self) -> Result<(), Self::Error>;        where T: Deserialize;    fn visit<T>(&mut self) -> Result<Option<T>, Self::Error>    type Error: Error;pub trait SeqVisitor {///////////////////////////////////////////////////////////////////////////////}    }        self.visit_bytes(&v)    {        where E: Error,    fn visit_byte_buf<E>(&mut self, v: Vec<u8>) -> Result<Self::Value, E>    }        Err(Error::syntax("expected a &[u8]"))    {        where E: Error,    fn visit_bytes<E>(&mut self, _v: &[u8]) -> Result<Self::Value, E>    }        Err(Error::syntax("expected a map"))    {        where V: MapVisitor,    fn visit_map<V>(&mut self, _visitor: V) -> Result<Self::Value, V::Error>    }        Err(Error::syntax("expected a sequence"))    {        where V: SeqVisitor,    fn visit_seq<V>(&mut self, _visitor: V) -> Result<Self::Value, V::Error>    }        Err(Error::syntax("expected a newtype struct"))    {        where D: Deserializer,    fn visit_newtype_struct<D>(&mut self, _deserializer: &mut D) -> Result<Self::Value, D::Error>    }        Err(Error::syntax("expected an Option::Some"))    {        where D: Deserializer,    fn visit_some<D>(&mut self, _deserializer: &mut D) -> Result<Self::Value, D::Error>    }        Err(Error::syntax("expected an Option::None"))    {        where E: Error,    fn visit_none<E>(&mut self) -> Result<Self::Value, E>    }        self.visit_unit()    {        where E: Error,    fn visit_unit_struct<E>(&mut self, _name: &'static str) -> Result<Self::Value, E>    #[inline]    }        Err(Error::syntax("expected a unit"))    {        where E: Error,    fn visit_unit<E>(&mut self) -> Result<Self::Value, E>    }        self.visit_str(&v)    {        where E: Error,    fn visit_string<E>(&mut self, v: String) -> Result<Self::Value, E>    #[inline]    }        Err(Error::syntax("expected a str"))    {        where E: Error,    fn visit_str<E>(&mut self, _v: &str) -> Result<Self::Value, E>    }        self.visit_string(v.to_string())        // doesn't support encoding a `char` into a stack buffer.        // FIXME: this allocation is required in order to be compatible with stable rust, which    {        where E: Error,    fn visit_char<E>(&mut self, v: char) -> Result<Self::Value, E>    #[inline]    }        Err(Error::syntax("expected a f64"))    {        where E: Error,    fn visit_f64<E>(&mut self, _v: f64) -> Result<Self::Value, E>    }        self.visit_f64(v as f64)    {        where E: Error,    fn visit_f32<E>(&mut self, v: f32) -> Result<Self::Value, E>    }