You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As yaml_rust seems unmaintained, I'm considering switching to minimal-yaml. But as a relative newbie to Rust, I have problems figuring out how to access elements in the minimal-yaml representation.
With yaml_rust, I do stuff like this:
let txt = std::fs::read_to_string("src/simple.yml").unwrap();let docs = YamlLoader::load_from_str(&txt).unwrap();// Sequencelet steps = docs[0]["recipe"]["steps"].as_vec().unwrap();for s in steps {
...}// Mappinglet globals = docs[0]["recipe"]["globals"].as_hash().unwrap();let iter = globals.iter();for(arg, val)in iter {
...}
With minimal-yaml, I can get as far as:
let txt = std::fs::read_to_string("src/simple.yml").unwrap();let rep = parse(&txt).unwrap();// This works as expectedprintln!("{:?}", rep);
But I cannot figure out how to loop/search the representation with minimal-yaml. To get me started, a few usage examples in the documentation would be very helpful.
// But how can I do this properly?for r in&rep {println!("r: {:?}", dd);}
The text was updated successfully, but these errors were encountered:
As yaml_rust seems unmaintained, I'm considering switching to minimal-yaml. But as a relative newbie to Rust, I have problems figuring out how to access elements in the minimal-yaml representation.
With yaml_rust, I do stuff like this:
With minimal-yaml, I can get as far as:
But I cannot figure out how to loop/search the representation with minimal-yaml. To get me started, a few usage examples in the documentation would be very helpful.
The text was updated successfully, but these errors were encountered: