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

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, ParsedKind::Obj) // Streamer.path == ""
Start( 1, ParsedKind::Arr) // Streamer.path == "{\"People\"}"
Start( 3, ParsedKind::Obj) // Streamer.path == "{\"People\"}[0]"
Start( 4, ParsedKind::Num) // Streamer.path == "{\"People\"}[0]{\"Height\"}"
End(   5, ParsedKind::Num)
Start( 6, ParsedKind::Num) // Streamer.path == "{\"People\"}[0]{\"Age\"}"
End(   7, ParsedKind::Num)
End(   8, ParsedKind::Obj)
Start( 9, ParsedKind::Obj) // Streamer.path == "{\"People\"}[1]"
Start(10, ParsedKind::Num) // Streamer.path == "{\"People\"}[1]{\"Height\"}"
End(  11, ParsedKind::Num)
Start(12, ParsedKind::Num) // Streamer.path == "{\"People\"}[1]{\"Age\"}"
End(  13, ParsedKind::Num)
End(  14, ParsedKind::Obj)
End(  15, ParsedKind::Arr)
End(  16, ParsedKind::Obj)

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<Token, General>[src]

Reads data from streamer and emits Token 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]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Streamer[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.