[][src]Struct ion_binary_rs::IonParser

pub struct IonParser<T: Read> { /* fields omitted */ }

In order to use it call the new method and then the "consume_all" method.

Example


use ion_binary_rs::IonParser;

// This is the response from Amazon's QLDB introduction example using Rusoto
let ion_test = b"\xe0\x01\0\xea\xee\xa6\x81\x83\xde\xa2\x87\xbe\x9f\x83VIN\x84Type\x84Year\x84Make\x85Model\x85Color\xde\xb9\x8a\x8e\x911C4RJFAG0FC625797\x8b\x85Sedan\x8c\"\x07\xe3\x8d\x88Mercedes\x8e\x87CLK 350\x8f\x85White";

let mut parser = IonParser::new(&ion_test[..]);

println!("Decoded Ion: {:?}", parser.consume_all().unwrap())
// Decoded Ion: [Struct({"Color": String("White"), "Year": Integer(2019), "VIN": String("1C4RJFAG0FC625797"), "Make": String("Mercedes"), "Model": String("CLK 350"), "Type": String("Sedan")})]

Implementations

impl<T: Read> IonParser<T>[src]

pub fn new(reader: T) -> IonParser<T>[src]

Creates a new parser. It accepts anything that implements the trait Read Trait

pub fn with_shared_table(
    &mut self,
    name: String,
    version: u32,
    symbols: &[String]
) -> Result<(), SymbolContextError>
[src]

Allows to set up shared tables in order to define symbols that are not in the binary blob. This is useful when decoding binaries that depend of huge tables that are expected to exist in the client and not to be sent in the ion binary.

pub fn consume_all(&mut self) -> Result<Vec<IonValue>, IonParserError>[src]

Consumes all the IonValues in the binary blob and returns an array with them.

pub fn consume_value(&mut self) -> Result<(IonValue, usize), IonParserError>[src]

Consumes one IonValue and stops. This function will automatically process NOP Padding, Shared Tables and Local Tables, automatically continuing in case that any of them are found.

Trait Implementations

impl<T: Debug + Read> Debug for IonParser<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for IonParser<T> where
    T: RefUnwindSafe

impl<T> Send for IonParser<T> where
    T: Send

impl<T> Sync for IonParser<T> where
    T: Sync

impl<T> Unpin for IonParser<T> where
    T: Unpin

impl<T> UnwindSafe for IonParser<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.