pub struct Decoder { /* private fields */ }
Expand description

A structure to decode JSON to values in rust.

Implementations§

source§

impl Decoder

source

pub fn new(json: Json) -> Decoder

Creates a new decoder instance for decoding the specified JSON value.

Trait Implementations§

source§

impl Decoder for Decoder

§

type Error = DecoderError

The error type for method results.
source§

fn read_nil(&mut self) -> DecodeResult<()>

Read a nil value.
source§

fn read_usize(&mut self) -> DecodeResult<usize>

Read a usize value.
source§

fn read_u8(&mut self) -> DecodeResult<u8>

Read a u8 value.
source§

fn read_u16(&mut self) -> DecodeResult<u16>

Read a u16 value.
source§

fn read_u32(&mut self) -> DecodeResult<u32>

Read a u32 value.
source§

fn read_u64(&mut self) -> DecodeResult<u64>

Read a u64 value.
source§

fn read_isize(&mut self) -> DecodeResult<isize>

Read a isize value.
source§

fn read_i8(&mut self) -> DecodeResult<i8>

Read a i8 value.
source§

fn read_i16(&mut self) -> DecodeResult<i16>

Read a i16 value.
source§

fn read_i32(&mut self) -> DecodeResult<i32>

Read a i32 value.
source§

fn read_i64(&mut self) -> DecodeResult<i64>

Read a i64 value.
source§

fn read_f32(&mut self) -> DecodeResult<f32>

Read a f32 value.
source§

fn read_f64(&mut self) -> DecodeResult<f64>

Read a f64 value.
source§

fn read_bool(&mut self) -> DecodeResult<bool>

Read a bool value.
source§

fn read_char(&mut self) -> DecodeResult<char>

Read a char value.
source§

fn read_str(&mut self) -> DecodeResult<String>

Read a string value.
source§

fn read_enum<T, F>(&mut self, _name: &str, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read an enumeration value. Read more
source§

fn read_enum_variant<T, F>(&mut self, names: &[&str], f: F) -> DecodeResult<T>where F: FnMut(&mut Decoder, usize) -> DecodeResult<T>,

Read an enumeration value. Read more
source§

fn read_enum_variant_arg<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read an unnamed data item for an enumeration variant. Read more
source§

fn read_enum_struct_variant<T, F>( &mut self, names: &[&str], f: F ) -> DecodeResult<T>where F: FnMut(&mut Decoder, usize) -> DecodeResult<T>,

Read an enumeration value. Read more
source§

fn read_enum_struct_variant_field<T, F>( &mut self, _name: &str, idx: usize, f: F ) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read a named data item for an enumeration variant. Read more
source§

fn read_struct<T, F>( &mut self, _name: &str, _len: usize, f: F ) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read an struct value. Read more
source§

fn read_struct_field<T, F>( &mut self, name: &str, _idx: usize, f: F ) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read a field for a struct value. Read more
source§

fn read_tuple<T, F>(&mut self, tuple_len: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read a tuple value. Read more
source§

fn read_tuple_arg<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read a data item for a tuple. Read more
source§

fn read_tuple_struct<T, F>( &mut self, _name: &str, len: usize, f: F ) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read a tuple struct value. Read more
source§

fn read_tuple_struct_arg<T, F>(&mut self, idx: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read a data item for a tuple struct. Read more
source§

fn read_option<T, F>(&mut self, f: F) -> DecodeResult<T>where F: FnMut(&mut Decoder, bool) -> DecodeResult<T>,

Read an optional value. Read more
source§

fn read_seq<T, F>(&mut self, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder, usize) -> DecodeResult<T>,

Read a sequence of values. Read more
source§

fn read_seq_elt<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read an element in the sequence. Read more
source§

fn read_map<T, F>(&mut self, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder, usize) -> DecodeResult<T>,

Read an associative container (map). Read more
source§

fn read_map_elt_key<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read the key for an entry in a map. Read more
source§

fn read_map_elt_val<T, F>(&mut self, _idx: usize, f: F) -> DecodeResult<T>where F: FnOnce(&mut Decoder) -> DecodeResult<T>,

Read the value for an entry in a map. Read more
source§

fn error(&mut self, err: &str) -> DecoderError

Record a decoding error. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<D> DecoderHelpers for Dwhere D: Decoder,

source§

fn read_to_vec<T, F>(&mut self, f: F) -> Result<Vec<T>, <D as Decoder>::Error>where F: FnMut(&mut D) -> Result<T, <D as Decoder>::Error>,

Read a sequence into a vector. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.