Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
SunDoge committed Aug 24, 2023
1 parent a10d2ec commit 1347fc4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CI](https://github.com/SunDoge/simdjson-rust/actions/workflows/CI.yml/badge.svg)](https://github.com/SunDoge/simdjson-rust/actions/workflows/CI.yml)

This crate currently uses `simdjson 2.2.2`. You can have a try and give feedback.
This crate currently uses `simdjson 3.2.3`. You can have a try and give feedback.

## Usage

Expand All @@ -16,27 +16,16 @@ simdjson-rust = {git = "https://github.com/SunDoge/simdjson-rust"}
Then, get started.

```rust
use simdjson_rust::dom;

fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut parser = dom::Parser::default();
let tweets = parser.load("json-examples/twitter.json")?;
println!(
"{} results.",
tweets
.at_key("search_metadata")?
.at_key("count")?
.get_u64()?
);
use simdjson_rust::{error::Result, ondemand::parser::Parser, padded_string::make_padded_string};

fn main() -> Result<()> {
let mut parser = Parser::default();
let ps = make_padded_string("[0,1,2,3]");
let mut doc = parser.iterate(&ps)?;
let mut array = doc.get_array()?;
for (index, value) in array.iter()?.enumerate() {
assert_eq!(index as u64, value?.get_uint64()?);
}
Ok(())
}
```

## Roadmap

- [x] ParsedJson
- [x] ParsedJsonIterator
- [x] printjson (impl Display)
- [x] ci
- [ ] tests
- [ ] benchmark
12 changes: 12 additions & 0 deletions examples/simple.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use simdjson_rust::{error::Result, ondemand::parser::Parser, padded_string::make_padded_string};

fn main() -> Result<()> {
let mut parser = Parser::default();
let ps = make_padded_string("[0,1,2,3]");
let mut doc = parser.iterate(&ps)?;
let mut array = doc.get_array()?;
for (index, value) in array.iter()?.enumerate() {
assert_eq!(index as u64, value?.get_uint64()?);
}
Ok(())
}

0 comments on commit 1347fc4

Please sign in to comment.