Docs.rs
  • json-event-parser-0.2.2
    • json-event-parser 0.2.2
    • Permalink
    • Docs.rs crate page
    • MIT OR Apache-2.0
    • Links
    • Homepage
    • Repository
    • crates.io
    • Source
    • Owners
    • Tpt
    • Dependencies
      • tokio ^1.29 normal optional
      • clap ^4 dev
      • codspeed-criterion-compat ^2.3.3 dev
      • tokio ^1.29 dev
    • Versions
    • 42.5% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Badges
    • Builds
    • Metadata
    • Shorthand URLs
    • Download
    • Rustdoc JSON
    • Build queue
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate json_event_parser

json_event_parser0.2.2

  • All Items

Sections

  • JSON streaming parser and serializer
    • License

Crate Items

  • Structs
  • Enums
  • Type Aliases

Crates

  • json_event_parser

Crate json_event_parser

Source
Expand description

§JSON streaming parser and serializer

actions status Latest Version Released API docs

JSON event parser is a simple streaming JSON parser and serializer implementation in Rust.

It does not aims to be the fastest JSON parser possible but to be a simple implementation allowing to parse larger than memory files.

If you want fast and battle-tested code you might prefer to use json, serde_json or simd-json.

Parser example:

use json_event_parser::{ReaderJsonParser, JsonEvent};

let json = b"{\"foo\": 1}";
let mut reader = ReaderJsonParser::new(json.as_slice());
assert_eq!(reader.parse_next()?, JsonEvent::StartObject);
assert_eq!(reader.parse_next()?, JsonEvent::ObjectKey("foo".into()));
assert_eq!(reader.parse_next()?, JsonEvent::Number("1".into()));
assert_eq!(reader.parse_next()?, JsonEvent::EndObject);
assert_eq!(reader.parse_next()?, JsonEvent::Eof);

Serializer example:

use json_event_parser::{WriterJsonSerializer, JsonEvent};

let mut writer = WriterJsonSerializer::new(Vec::new());
writer.write_event(JsonEvent::StartObject) ?;
writer.write_event(JsonEvent::ObjectKey("foo".into())) ?;
writer.write_event(JsonEvent::Number("1".into())) ?;
writer.write_event(JsonEvent::EndObject) ?;

assert_eq!(writer.finish()?.as_slice(), b"{\"foo\":1}");

§License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
  • MIT license (LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in json-event-parser by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Structs§

JsonSyntaxError
An error in the syntax of the parsed file.
LowLevelJsonParser
A low-level JSON parser acting on a provided buffer.
LowLevelJsonParserResult
Result of LowLevelJsonParser::parse_next.
LowLevelJsonSerializer
A low-level JSON streaming writer writing to a Write implementation.
ReaderJsonParser
Parses a JSON file from a Read implementation.
SliceJsonParser
Parses a JSON file from a &[u8].
TextPosition
A position in a text i.e. a line number starting from 0, a column number starting from 0 (in number of code points) and a global file offset starting from 0 (in number of bytes).
TokioAsyncReaderJsonParserasync-tokio
Parses a JSON file from an AsyncRead implementation.
TokioAsyncWriterJsonSerializerasync-tokio
A JSON streaming writer writing to an AsyncWrite implementation.
WriterJsonSerializer
A JSON streaming writer writing to a Write implementation.

Enums§

JsonEvent
Possible events during JSON parsing.
JsonParseError
A parsing error.

Type Aliases§

FromBufferJsonReaderDeprecated
FromReadJsonReaderDeprecated
FromTokioAsyncReadJsonReaderDeprecatedasync-tokio
LowLevelJsonReaderDeprecated
LowLevelJsonReaderResultDeprecated
LowLevelJsonWriterDeprecated
ParseErrorDeprecated
SyntaxErrorDeprecated
ToTokioAsyncWriteJsonWriterDeprecatedasync-tokio
ToWriteJsonWriterDeprecated

Results

Settings
Help

Type "ToTokioAsyncWriteJsonWriter" not found. Showing results for closest type name "tokioasyncwriterjsonserializer" instead.

    type alias
    json_event_parser::ToTokioAsyncWriteJsonWriter
    method
    json_event_parser::TokioAsyncWriterJsonSerializer::finish
    TokioAsyncWriterJsonSerializer<W> -> Result<W>
    method
    json_event_parser::TokioAsyncWriterJsonSerializer::serialize_event
    &mut TokioAsyncWriterJsonSerializer<W>, JsonEvent -> Result<()>
    method
    json_event_parser::TokioAsyncWriterJsonSerializer::write_event
    &mut TokioAsyncWriterJsonSerializer<W>, JsonEvent -> Result<()>
    method
    json_event_parser::TokioAsyncWriterJsonSerializer::new
    W -> TokioAsyncWriterJsonSerializer<W>