Crate yajlish[][src]

Expand description

yajlish is a low-level, event-based json parser based (loosely) on yajl. Use

    use yajlish::{Context, Handler, Status};

    pub struct FooCountHandler {
        count: usize,
    }

    impl Handler for FooCountHandler {
         
        fn handle_map_key(&mut self, _ctx: &Context, key: &str) -> Status {
            if key == "\"foo\"" {
                self.count += 1;
            }
            Status::Continue
        }
     
        fn handle_null(&mut self, _ctx: &Context) -> Status {
            Status::Continue
        }

        fn handle_bool(&mut self, _ctx: &Context, boolean: bool) -> Status {
            Status::Continue
        }

        fn handle_double(&mut self, _ctx: &Context, val: f64) -> Status {
            Status::Continue
        }
         
        fn handle_int(&mut self, _ctx: &Context, val: i64) -> Status {
            Status::Continue
        }

        fn handle_string(&mut self, _ctx: &Context, val: &str) -> Status {
            Status::Continue
        }

        fn handle_start_map(&mut self, _ctx: &Context) -> Status {
            Status::Continue
        }
         
        fn handle_start_array(&mut self, _ctx: &Context) -> Status {
            Status::Continue
        }

        fn handle_end_map(&mut self, _ctx: &Context) -> Status {
            Status::Continue
        }

        fn handle_end_array(&mut self, _ctx: &Context) -> Status {
            Status::Continue
        }
    }

Modules

This Handler implementation converts JSON with an array into new-line delimited JSON.

Structs

The context passed to each Handler function. Context gives basic information about where it is at in the json document.

Main Parser struct.

Enums

Brackets and Braces to keep track of.

The state that the parser is in.

The Status that each Handler method returns.

Traits

Implement this trait to handle parse events.