[][src]Struct streamson_lib::streamer::Streamer

pub struct Streamer { /* fields omitted */ }

Reads parts of UTF-8 json input and emits paths e.g. reading of

{
    "People": [
        {"Height": 180, "Age": 33},
        {"Height": 175, "Age": 24}
    ]
}

should emit (index and path)

Start( 0) // Streamer.path == ""
Start( 1) // Streamer.path == "{\"People\"}"
Start( 3) // Streamer.path == "{\"People\"}[0]"
Start( 4) // Streamer.path == "{\"People\"}[0]{\"Height\"}"
End(   5)
Start( 6) // Streamer.path == "{\"People\"}[0]{\"Age\"}"
End(   7)
End(   8)
Start( 9) // Streamer.path == "{\"People\"}[1]"
Start(10) // Streamer.path == "{\"People\"}[1]{\"Height\"}"
End(  11)
Start(12) // Streamer.path == "{\"People\"}[1]{\"Age\"}"
End(  13)
End(  14)
End(  15)
End(  16)

Implementations

impl Streamer[src]

pub fn new() -> Self[src]

Creates a new instance of streamer

pub fn current_path(&mut self) -> &mut Path[src]

Returns current path

pub fn feed(&mut self, input: &[u8])[src]

Feed streamer with data

pub fn read(&mut self) -> Result<Output, General>[src]

Reads data from streamer and emits Output struct

Errors

If invalid JSON is passed and error may be emitted. Note that validity of input JSON is not checked.

Trait Implementations

impl Debug for Streamer[src]

impl Default for Streamer[src]

Auto Trait Implementations

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, 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.