Skip to content

Commit 3465f59

Browse files
author
Marcus Ewert
committed
Add README and license
1 parent 70b0c39 commit 3465f59

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "qjsonrs"
33
version = "0.1.0"
44
authors = ["Marcus Ewert <[email protected]>"]
5+
license = "MIT"
56
edition = "2018"
67

78
[dependencies]

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2019 Marcus Henry Ewert
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# qjsonrs
2+
3+
A Rust implementation of a JSON Tokenizer.
4+
5+
## Motivation
6+
7+
Streaming tokenization for handling large JSON payloads which can be processed
8+
without loading the whole JSON object into memory.
9+
10+
## Iterator interface.
11+
12+
The steam of JsonTokens emitted by this crate unfortunately cannot quite
13+
provide the Iter interface. The reason is: the emitted JsonTokens refer to an
14+
internal buffer of the stream, and thus maintain a reference to the stream.
15+
16+
Also, the iterator returns Results, to enable reporting of IO or JSON encoding errors.
17+
18+
## Example:
19+
20+
```rust
21+
use qjsonrs::{
22+
JsonStream,
23+
JsonToken::JsBoolean
24+
}
25+
26+
let mut stream = JsonStream::from_read(file)?;
27+
while Some(t) = stream.next()? {
28+
match t {
29+
JsonToken::JsBoolean(b) => { println!("Got JSON boolean: {:?}", b) },
30+
o => { println!("Got other JSON token boolean: {:?}", o) },
31+
}
32+
}
33+
println!("Done reading stream.");
34+
```

0 commit comments

Comments
 (0)