Trait rustc_serialize::Decodable
[−]
[src]
Trait for deserializing a type.
This can be implemented for custom data types to allow them to be decoded
with Decoder
implementations. Most of Rust's built-in or standard data
types (like i32
and Vec<T>
) have Decodable
implementations provided by
this module.
Note that, in general, you should let the compiler implement this for you by
using the derive(RustcDecodable)
attribute.
Examples
extern crate rustc_serialize; #[derive(RustcDecodable)] struct Point { x: i32, y: i32, }
This generates code equivalent to:
extern crate rustc_serialize; use rustc_serialize::Decodable; use rustc_serialize::Decoder; struct Point { x: i32, y: i32, } impl Decodable for Point { fn decode<D: Decoder>(d: &mut D) -> Result<Point, D::Error> { d.read_struct("Point", 2, |d| { let x = try!(d.read_struct_field("x", 0, |d| { d.read_i32() })); let y = try!(d.read_struct_field("y", 1, |d| { d.read_i32() })); Ok(Point{ x: x, y: y }) }) } }
Required Methods
Implementations on Foreign Types
impl Decodable for usize
[src]
impl Decodable for usize
impl Decodable for u8
[src]
impl Decodable for u8
impl Decodable for u16
[src]
impl Decodable for u16
impl Decodable for u32
[src]
impl Decodable for u32
impl Decodable for u64
[src]
impl Decodable for u64
impl Decodable for isize
[src]
impl Decodable for isize
impl Decodable for i8
[src]
impl Decodable for i8
impl Decodable for i16
[src]
impl Decodable for i16
impl Decodable for i32
[src]
impl Decodable for i32
impl Decodable for i64
[src]
impl Decodable for i64
impl Decodable for String
[src]
impl Decodable for String
impl Decodable for f32
[src]
impl Decodable for f32
impl Decodable for f64
[src]
impl Decodable for f64
impl Decodable for bool
[src]
impl Decodable for bool
impl Decodable for char
[src]
impl Decodable for char
impl Decodable for ()
[src]
impl Decodable for ()
impl<T: Decodable> Decodable for Box<T>
[src]
impl<T: Decodable> Decodable for Box<T>
impl<T: Decodable> Decodable for Box<[T]>
[src]
impl<T: Decodable> Decodable for Box<[T]>
impl<T: Decodable> Decodable for Rc<T>
[src]
impl<T: Decodable> Decodable for Rc<T>
impl<'a, T: ?Sized> Decodable for Cow<'a, T> where
T: ToOwned,
T::Owned: Decodable,
[src]
impl<'a, T: ?Sized> Decodable for Cow<'a, T> where
T: ToOwned,
T::Owned: Decodable,
impl<T: Decodable> Decodable for Vec<T>
[src]
impl<T: Decodable> Decodable for Vec<T>
impl<T: Decodable> Decodable for Option<T>
[src]
impl<T: Decodable> Decodable for Option<T>
impl<T: Decodable, E: Decodable> Decodable for Result<T, E>
[src]
impl<T: Decodable, E: Decodable> Decodable for Result<T, E>
impl<T> Decodable for PhantomData<T>
[src]
impl<T> Decodable for PhantomData<T>
impl<T0: Decodable, T1: Decodable, T2: Decodable, T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
[src]
impl<T0: Decodable, T1: Decodable, T2: Decodable, T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
impl<T1: Decodable, T2: Decodable, T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
[src]
impl<T1: Decodable, T2: Decodable, T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
impl<T2: Decodable, T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
[src]
impl<T2: Decodable, T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T2, T3, T4, T5, T6, T7, T8, T9, T10, T11)
impl<T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T3, T4, T5, T6, T7, T8, T9, T10, T11)
[src]
impl<T3: Decodable, T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T3, T4, T5, T6, T7, T8, T9, T10, T11)
impl<T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T4, T5, T6, T7, T8, T9, T10, T11)
[src]
impl<T4: Decodable, T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T4, T5, T6, T7, T8, T9, T10, T11)
impl<T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T5, T6, T7, T8, T9, T10, T11)
[src]
impl<T5: Decodable, T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T5, T6, T7, T8, T9, T10, T11)
impl<T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T6, T7, T8, T9, T10, T11)
[src]
impl<T6: Decodable, T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T6, T7, T8, T9, T10, T11)
impl<T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T7, T8, T9, T10, T11)
[src]
impl<T7: Decodable, T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T7, T8, T9, T10, T11)
impl<T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T8, T9, T10, T11)
[src]
impl<T8: Decodable, T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T8, T9, T10, T11)
impl<T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T9, T10, T11)
[src]
impl<T9: Decodable, T10: Decodable, T11: Decodable> Decodable for (T9, T10, T11)
impl<T10: Decodable, T11: Decodable> Decodable for (T10, T11)
[src]
impl<T10: Decodable, T11: Decodable> Decodable for (T10, T11)
impl<T11: Decodable> Decodable for (T11,)
[src]
impl<T11: Decodable> Decodable for (T11,)
impl<T: Decodable> Decodable for [T; 32]
[src]
impl<T: Decodable> Decodable for [T; 32]
impl<T: Decodable> Decodable for [T; 31]
[src]
impl<T: Decodable> Decodable for [T; 31]
impl<T: Decodable> Decodable for [T; 30]
[src]
impl<T: Decodable> Decodable for [T; 30]
impl<T: Decodable> Decodable for [T; 29]
[src]
impl<T: Decodable> Decodable for [T; 29]
impl<T: Decodable> Decodable for [T; 28]
[src]
impl<T: Decodable> Decodable for [T; 28]
impl<T: Decodable> Decodable for [T; 27]
[src]
impl<T: Decodable> Decodable for [T; 27]
impl<T: Decodable> Decodable for [T; 26]
[src]
impl<T: Decodable> Decodable for [T; 26]
impl<T: Decodable> Decodable for [T; 25]
[src]
impl<T: Decodable> Decodable for [T; 25]
impl<T: Decodable> Decodable for [T; 24]
[src]
impl<T: Decodable> Decodable for [T; 24]
impl<T: Decodable> Decodable for [T; 23]
[src]
impl<T: Decodable> Decodable for [T; 23]
impl<T: Decodable> Decodable for [T; 22]
[src]
impl<T: Decodable> Decodable for [T; 22]
impl<T: Decodable> Decodable for [T; 21]
[src]
impl<T: Decodable> Decodable for [T; 21]
impl<T: Decodable> Decodable for [T; 20]
[src]
impl<T: Decodable> Decodable for [T; 20]
impl<T: Decodable> Decodable for [T; 19]
[src]
impl<T: Decodable> Decodable for [T; 19]
impl<T: Decodable> Decodable for [T; 18]
[src]
impl<T: Decodable> Decodable for [T; 18]
impl<T: Decodable> Decodable for [T; 17]
[src]
impl<T: Decodable> Decodable for [T; 17]
impl<T: Decodable> Decodable for [T; 16]
[src]
impl<T: Decodable> Decodable for [T; 16]
impl<T: Decodable> Decodable for [T; 15]
[src]
impl<T: Decodable> Decodable for [T; 15]
impl<T: Decodable> Decodable for [T; 14]
[src]
impl<T: Decodable> Decodable for [T; 14]
impl<T: Decodable> Decodable for [T; 13]
[src]
impl<T: Decodable> Decodable for [T; 13]
impl<T: Decodable> Decodable for [T; 12]
[src]
impl<T: Decodable> Decodable for [T; 12]
impl<T: Decodable> Decodable for [T; 11]
[src]
impl<T: Decodable> Decodable for [T; 11]
impl<T: Decodable> Decodable for [T; 10]
[src]
impl<T: Decodable> Decodable for [T; 10]
impl<T: Decodable> Decodable for [T; 9]
[src]
impl<T: Decodable> Decodable for [T; 9]
impl<T: Decodable> Decodable for [T; 8]
[src]
impl<T: Decodable> Decodable for [T; 8]
impl<T: Decodable> Decodable for [T; 7]
[src]
impl<T: Decodable> Decodable for [T; 7]
impl<T: Decodable> Decodable for [T; 6]
[src]
impl<T: Decodable> Decodable for [T; 6]
impl<T: Decodable> Decodable for [T; 5]
[src]
impl<T: Decodable> Decodable for [T; 5]
impl<T: Decodable> Decodable for [T; 4]
[src]
impl<T: Decodable> Decodable for [T; 4]
impl<T: Decodable> Decodable for [T; 3]
[src]
impl<T: Decodable> Decodable for [T; 3]
impl<T: Decodable> Decodable for [T; 2]
[src]
impl<T: Decodable> Decodable for [T; 2]
impl<T: Decodable> Decodable for [T; 1]
[src]
impl<T: Decodable> Decodable for [T; 1]
impl<T: Decodable> Decodable for [T; 0]
[src]
impl<T: Decodable> Decodable for [T; 0]
impl Decodable for PathBuf
[src]
impl Decodable for PathBuf
impl<T: Decodable + Copy> Decodable for Cell<T>
[src]
impl<T: Decodable + Copy> Decodable for Cell<T>
impl<T: Decodable> Decodable for RefCell<T>
[src]
impl<T: Decodable> Decodable for RefCell<T>
impl<T: Decodable + Send + Sync> Decodable for Arc<T>
[src]
impl<T: Decodable + Send + Sync> Decodable for Arc<T>
impl<T: Decodable> Decodable for LinkedList<T>
[src]
impl<T: Decodable> Decodable for LinkedList<T>
impl<T: Decodable> Decodable for VecDeque<T>
[src]
impl<T: Decodable> Decodable for VecDeque<T>
impl<K: Decodable + Ord, V: Decodable> Decodable for BTreeMap<K, V>
[src]
impl<K: Decodable + Ord, V: Decodable> Decodable for BTreeMap<K, V>
impl<T: Decodable + Ord> Decodable for BTreeSet<T>
[src]
impl<T: Decodable + Ord> Decodable for BTreeSet<T>
impl<K, V> Decodable for HashMap<K, V> where
K: Decodable + Hash + Eq,
V: Decodable,
[src]
impl<K, V> Decodable for HashMap<K, V> where
K: Decodable + Hash + Eq,
V: Decodable,
impl<T> Decodable for HashSet<T> where
T: Decodable + Hash + Eq,
[src]
impl<T> Decodable for HashSet<T> where
T: Decodable + Hash + Eq,