Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
docs: add link to csln-rs repo
Browse files Browse the repository at this point in the history
Signed-off-by: Bruce D'Arcus <bdarcus@gmail.com>
  • Loading branch information
bdarcus committed May 24, 2023
1 parent 17a1647 commit 2d9b5f8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,7 @@ $ quicktype schemas/csl-style-schema.json -o style.rs
Note that the generated code will include a model definition, that should mostly
match the typescript model, _and_ serialization and deserialization code.

Here’s some minimal rust code to deserialize and serialize the JSON example
style file to Rust Style struct, with result `APA`:

```rust
fn main() {
let json = fs::read_to_string("src/style.csl.json")
.expect("Unable to read file");
let style: Style = serde_json::from_str(&json).unwrap();
println!("{}", serde_json::to_string(&style.title).unwrap());
}
```
[Here's a small demo repository](https://github.com/bdarcus/csln-rs) that includes a script to run this conversion, and then builds a simple rust binary that can read and write a `Style` or `InputReference`.

Feel free to experiment with your language of choice and report your experience!

Expand Down

0 comments on commit 2d9b5f8

Please sign in to comment.