Struct Decoder

Source
pub struct Decoder<R: Read> { /* private fields */ }
Expand description

§Note

All instances of ErrorKind::Interrupted are handled by this function and the underlying operation is retried.

Implementations§

Source§

impl<R: Read> Decoder<R>

Source

pub fn new(rd: R) -> Decoder<R>

Source

pub fn get_ref(&self) -> &R

Gets a reference to the underlying reader in this decoder.

Source

pub fn get_mut(&mut self) -> &mut R

Gets a mutable reference to the underlying reader in this decoder.

Source

pub fn into_inner(self) -> R

Consumes this decoder returning the underlying reader.

Trait Implementations§

Source§

impl<R: Read> Decoder for Decoder<R>

Unstable: docs; examples; incomplete

Source§

fn read_option<T, F>(&mut self, f: F) -> Result<T, Error>
where F: FnMut(&mut Self, bool) -> Result<T, Error>,

We treat Value::Null as None.

Source§

type Error = Error

The error type for method results.
Source§

fn read_nil(&mut self) -> Result<(), Error>

Read a nil value.
Source§

fn read_bool(&mut self) -> Result<bool, Error>

Read a bool value.
Source§

fn read_u8(&mut self) -> Result<u8, Error>

Read a u8 value.
Source§

fn read_u16(&mut self) -> Result<u16, Error>

Read a u16 value.
Source§

fn read_u32(&mut self) -> Result<u32, Error>

Read a u32 value.
Source§

fn read_u64(&mut self) -> Result<u64, Error>

Read a u64 value.
Source§

fn read_usize(&mut self) -> Result<usize, Error>

Read a usize value.
Source§

fn read_i8(&mut self) -> Result<i8, Error>

Read a i8 value.
Source§

fn read_i16(&mut self) -> Result<i16, Error>

Read a i16 value.
Source§

fn read_i32(&mut self) -> Result<i32, Error>

Read a i32 value.
Source§

fn read_i64(&mut self) -> Result<i64, Error>

Read a i64 value.
Source§

fn read_isize(&mut self) -> Result<isize, Error>

Read a isize value.
Source§

fn read_f32(&mut self) -> Result<f32, Error>

Read a f32 value.
Source§

fn read_f64(&mut self) -> Result<f64, Error>

Read a f64 value.
Source§

fn read_char(&mut self) -> Result<char, Error>

Read a char value.
Source§

fn read_str(&mut self) -> Result<String, Error>

Read a string value.
Source§

fn read_enum<T, F>(&mut self, _name: &str, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

Read an enumeration value. Read more
Source§

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

Read an enumeration value. Read more
Source§

fn read_enum_variant_arg<T, F>(&mut self, _idx: usize, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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, ) -> Result<T, Error>
where F: FnMut(&mut Self, usize) -> Result<T, Error>,

Read an enumeration value. Read more
Source§

fn read_enum_struct_variant_field<T, F>( &mut self, _name: &str, _idx: usize, f: F, ) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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, ) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

Read an struct value. Read more
Source§

fn read_struct_field<T, F>( &mut self, _name: &str, _idx: usize, f: F, ) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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

fn read_tuple<T, F>(&mut self, len: usize, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

Read a tuple value. Read more
Source§

fn read_tuple_arg<T, F>(&mut self, _idx: usize, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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

fn read_tuple_struct<T, F>( &mut self, _name: &str, _len: usize, _f: F, ) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

Read a tuple struct value. Read more
Source§

fn read_tuple_struct_arg<T, F>( &mut self, _idx: usize, _f: F, ) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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

fn read_seq<T, F>(&mut self, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self, usize) -> Result<T, Error>,

Read a sequence of values. Read more
Source§

fn read_seq_elt<T, F>(&mut self, _idx: usize, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

Read an element in the sequence. Read more
Source§

fn read_map<T, F>(&mut self, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self, usize) -> Result<T, Error>,

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

fn read_map_elt_key<T, F>(&mut self, _idx: usize, f: F) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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) -> Result<T, Error>
where F: FnOnce(&mut Self) -> Result<T, Error>,

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

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

Record a decoding error. Read more

Auto Trait Implementations§

§

impl<R> Freeze for Decoder<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Decoder<R>
where R: RefUnwindSafe,

§

impl<R> Send for Decoder<R>
where R: Send,

§

impl<R> Sync for Decoder<R>
where R: Sync,

§

impl<R> Unpin for Decoder<R>
where R: Unpin,

§

impl<R> UnwindSafe for Decoder<R>
where R: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<D> DecoderHelpers for D
where 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 T
where 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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.