Light Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

adam-mcdaniel/rusty-yaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

25 Commits

Repository files navigation

rusty-yaml

A rust library to parse yaml files.

Usage

Copy and paste the following into your Cargo.toml.

[dependencies]
rusty-yaml="0.4"

Examples

use rusty_yaml::Yaml;

fn main() {
let yaml_reader = Yaml::from(
"
builders:
clang-format:
worker: asgard-worker
script:
- ls

build:
worker: asgard-worker
script:
- mkdir build
- cd build
- cmake ..
- make -j
- ctest -j 4
",
);

println!(
"section names: {:?}",
yaml_reader
.get_section("builders").unwrap()
.get_section("build").unwrap()
.get_section_names()
);


for section in yaml_reader.get_section("builders") {
println!("```{}```", section);
}


println!("has builders: {}", yaml_reader.has_section("builders"));


for section in yaml_reader.get_section("builders").unwrap() {
println!("Name: {}", section.get_name());
for command in section.get_section("script").unwrap() {
println!("command: '{}'", command);
}
}
}

About

A high level rust library for parsing yaml files and strings.

Resources

Readme

License

Apache-2.0 license

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages