Trait binn_ir::value::Decoder[][src]

pub trait Decoder: Read + Sized {
    fn decode(&mut self) -> Result<Option<Value>> { ... }
fn decode_null(&mut self) -> Result<Option<()>> { ... }
fn decode_bool(&mut self) -> Result<Option<bool>> { ... }
fn decode_u8(&mut self) -> Result<Option<u8>> { ... }
fn decode_i8(&mut self) -> Result<Option<i8>> { ... }
fn decode_u16(&mut self) -> Result<Option<u16>> { ... }
fn decode_i16(&mut self) -> Result<Option<i16>> { ... }
fn decode_u32(&mut self) -> Result<Option<u32>> { ... }
fn decode_i32(&mut self) -> Result<Option<i32>> { ... }
fn decode_u64(&mut self) -> Result<Option<u64>> { ... }
fn decode_i64(&mut self) -> Result<Option<i64>> { ... }
fn decode_float(&mut self) -> Result<Option<f32>> { ... }
fn decode_double(&mut self) -> Result<Option<f64>> { ... }
fn decode_text(&mut self) -> Result<Option<String>> { ... }
fn decode_date_time(&mut self) -> Result<Option<String>> { ... }
fn decode_date(&mut self) -> Result<Option<String>> { ... }
fn decode_time(&mut self) -> Result<Option<String>> { ... }
fn decode_decimal_str(&mut self) -> Result<Option<String>> { ... }
fn decode_blob(&mut self) -> Result<Option<Vec<u8>>> { ... }
fn decode_list(&mut self) -> Result<Option<Vec<Value>>> { ... }
fn decode_map(&mut self) -> Result<Option<BTreeMap<i32, Value>>> { ... }
fn decode_object(&mut self) -> Result<Option<HashMap<String, Value>>> { ... } }

Decoder

Usage

Decoding any values

You can use ::decode() and a match to filter values. This function will hand you the values after finishing decoding process.

Decoding desired values

You can use ::decode_*(). However, please note that: if an un-expected value is detected, the whole decoding operation might be broken. It's because those functions just decode the header of a value, and stop if not matched. So at that point, data stream might already be broken.

In contrast, with ::decode(), when you expect an Object but get a List, you can still continue decoding next values.

Notes

  • If a ::decode*() function returns an Ok(None), it means there's no more data to decode.
  • Default implementors are copied from Read's.

Provided Methods

Implementations on Foreign Types

impl Decoder for File
[src]

impl<'a> Decoder for &'a File
[src]

impl<R: Read> Decoder for BufReader<R>
[src]

impl<T> Decoder for Cursor<T> where
    T: AsRef<[u8]>, 
[src]

impl<'a, R: Read + ?Sized> Decoder for &'a mut R
[src]

impl<R: Read + ?Sized> Decoder for Box<R>
[src]

impl<'a> Decoder for &'a [u8]
[src]

impl Decoder for Empty
[src]

impl Decoder for Repeat
[src]

impl Decoder for Stdin
[src]

impl<'a> Decoder for StdinLock<'a>
[src]

impl<T: Read, U: Read> Decoder for Chain<T, U>
[src]

impl<T: Read> Decoder for Take<T>
[src]

impl Decoder for TcpStream
[src]

impl<'a> Decoder for &'a TcpStream
[src]

impl Decoder for ChildStdout
[src]

impl Decoder for ChildStderr
[src]

impl Decoder for UnixStream
[src]

impl<'a> Decoder for &'a UnixStream
[src]

Implementors