Skip to content

Commit

Permalink
[node-js-release-info] add docs for json feature
Browse files Browse the repository at this point in the history
  • Loading branch information
busticated committed Oct 19, 2023
1 parent 5e60393 commit 0502a3e
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/node-js-release-info/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,23 @@ async fn main() -> Result<(), NodeJSRelInfoError> {
}
```

## Features

Full `json` serialization + deserialization is avaialable via the `json` feature.

```shell
cargo add node-js-release-info --features json
```

```rust
use node_js_release_info::{NodeJSRelInfo, NodeJSRelInfoError};

#[tokio::main]
async fn main() {
let info = NodeJSRelInfo::new("20.6.1").macos().arm64().to_owned();
let json = serde_json::to_string(&info).unwrap();
let info_deserialized = serde_json::from_str(&json).unwrap();
assert_eq!(info, info_deserialized);
}
```

0 comments on commit 0502a3e

Please sign in to comment.