Skip to content

Commit

Permalink
Update Cargo.tomls and add READMEs
Browse files Browse the repository at this point in the history
  • Loading branch information
nessex committed Nov 15, 2020
1 parent a9f7e91 commit b76ebb6
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion crates/yaml-split/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[package]
name = "yaml-split"
description = "provides an iterator over individual YAML documents in a YAML file or stream"
version = "0.2.1"
version = "0.2.2"
authors = ["Nathan Essex <nathan@essex.id.au>"]
edition = "2018"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/Nessex/yaml2json-rs"
homepage = "https://github.com/Nessex/yaml2json-rs/blob/master/crates/yaml-split"
categories = ["encoding"]
documentation = "https://docs.rs/yaml-split/"

[dependencies]
thiserror = "1.0.22"
35 changes: 35 additions & 0 deletions crates/yaml-split/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# yaml-split

yaml-split is a library which provides an iterator over individual YAML documents in a file or stream.

For example, you might have a YAML file like the following:

```
hello: world
---
foo: bar
```

This file contains two separate YAML documents. yaml-split will provide you the following two values in-order:

```
hello: world
```

```
---
foo: bar
```

This output is suitable for use by existing YAML deserializers such as [serde-yaml](https://github.com/dtolnay/serde-yaml).

## Usage

```
let file = File::open(f).unwrap();
let doc_iter = DocumentIterator::new(file);
for doc in doc_iter {
println!("Doc:\n{}\n", doc);
}
```
7 changes: 6 additions & 1 deletion crates/yaml2json-rs-bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
[package]
name = "yaml2json-rs-bin"
description = "Utility to convert YAML files to JSON"
version = "0.2.1"
version = "0.2.2"
authors = ["Nathan Essex <nathan@essex.id.au>"]
edition = "2018"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/Nessex/yaml2json-rs"
homepage = "https://github.com/Nessex/yaml2json-rs"
categories = ["command-line-utilities", "encoding"]
documentation = "https://docs.rs/yaml2json-rs/"
readme = "../../README.md"

[dependencies]
clap = "2.33.3"
Expand Down
6 changes: 5 additions & 1 deletion crates/yaml2json-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
[package]
name = "yaml2json-rs"
description = "Convert YAML documents to JSON"
version = "0.2.1"
version = "0.2.2"
authors = ["Nathan Essex <nathan@essex.id.au>"]
edition = "2018"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/Nessex/yaml2json-rs"
homepage = "https://github.com/Nessex/yaml2json-rs/blob/master/crates/yaml2json-rs"
categories = ["command-line-utilities", "encoding"]
documentation = "https://docs.rs/yaml2json-rs/"

[dependencies]
serde = "1.0"
Expand Down
18 changes: 18 additions & 0 deletions crates/yaml2json-rs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# yaml2json-rs

yaml2json-rs is a library which helps to convert YAML document strings to JSON. Output can be returned as a string, or passed on to anything that implements `io::Write`.

This library is a thin wrapper around [serde-yaml](https://github.com/dtolnay/serde-yaml) and [serde-json](https://github.com/serde-rs/json).

## Usage

```
let yaml = r#"
hello: world
"#;
let yaml2json = Yaml2Json::new(Style::PRETTY);
let json = yaml2json.document_to_string(yaml);
println!("{}", json);
```

0 comments on commit b76ebb6

Please sign in to comment.