{"id":15286518,"url":"https://github.com/ethiraric/yaml-rust2","last_synced_at":"2025-12-30T03:08:39.643Z","repository":{"id":189021045,"uuid":"679481072","full_name":"Ethiraric/yaml-rust2","owner":"Ethiraric","description":"A pure Rust YAML implementation.","archived":false,"fork":true,"pushed_at":"2024-11-10T17:08:18.000Z","size":574,"stargazers_count":172,"open_issues_count":2,"forks_count":14,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-12T05:12:23.463Z","etag":null,"topics":["rust","yaml","yaml-parser"],"latest_commit_sha":null,"homepage":"https://docs.rs/yaml-rust2/latest/yaml_rust2/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"chyh1990/yaml-rust","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ethiraric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-17T00:20:20.000Z","updated_at":"2025-01-01T18:48:05.000Z","dependencies_parsed_at":"2023-08-17T23:03:14.383Z","dependency_job_id":null,"html_url":"https://github.com/Ethiraric/yaml-rust2","commit_stats":null,"previous_names":["ethiraric/yaml-rust","ethiraric/yaml-rust2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethiraric%2Fyaml-rust2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethiraric%2Fyaml-rust2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethiraric%2Fyaml-rust2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ethiraric%2Fyaml-rust2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ethiraric","download_url":"https://codeload.github.com/Ethiraric/yaml-rust2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235575693,"owners_count":19012156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rust","yaml","yaml-parser"],"created_at":"2024-09-30T15:16:13.299Z","updated_at":"2025-10-07T01:31:02.513Z","avatar_url":"https://github.com/Ethiraric.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yaml-rust2\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e This crate will receive only basic maintenance and keep a stable API. [`saphyr`](https://github.com/saphyr-rs/saphyr) will accept new features, at the cost of a less stable API.\n\u003e \n\u003e Please refer to [#26](https://github.com/Ethiraric/yaml-rust2/issues/26) for more details.\n\n[yaml-rust2](https://github.com/Ethiraric/yaml-rust2) is a fully compliant YAML 1.2\nimplementation written in pure Rust.\n\nThis work is based on [`yaml-rust`](https://github.com/chyh1990/yaml-rust) with\nfixes towards being compliant to the [YAML test\nsuite](https://github.com/yaml/yaml-test-suite/). `yaml-rust`'s parser is\nheavily influenced by `libyaml` and `yaml-cpp`.\n\n`yaml-rust2` is a pure Rust YAML 1.2 implementation that benefits from the\nmemory safety and other benefits from the Rust language.\n\n## Quick Start\n\nTo add `yaml-rust2` to your project, run the following in the root of your project:\n\n```sh\ncargo add yaml-rust2\n```\n\nUse `yaml_rust2::YamlLoader` to load YAML documents and access them as `Yaml` objects:\n\n```rust\nuse yaml_rust2::{YamlLoader, YamlEmitter};\n\nfn main() {\n    let s =\n\"\nfoo:\n    - list1\n    - list2\nbar:\n    - 1\n    - 2.0\n\";\n    let docs = YamlLoader::load_from_str(s).unwrap();\n\n    // Multi document support, doc is a yaml::Yaml\n    let doc = \u0026docs[0];\n\n    // Debug support\n    println!(\"{:?}\", doc);\n\n    // Index access for map \u0026 array\n    assert_eq!(doc[\"foo\"][0].as_str().unwrap(), \"list1\");\n    assert_eq!(doc[\"bar\"][1].as_f64().unwrap(), 2.0);\n\n    // Array/map-like accesses are checked and won't panic.\n    // They will return `BadValue` if the access is invalid.\n    assert!(doc[\"INVALID_KEY\"][100].is_badvalue());\n\n    // Dump the YAML object\n    let mut out_str = String::new();\n    {\n        let mut emitter = YamlEmitter::new(\u0026mut out_str);\n        emitter.dump(doc).unwrap(); // dump the YAML object to a String\n    }\n    println!(\"{}\", out_str);\n}\n```\n\nNote that `yaml_rust2::Yaml` implements `Index\u003c\u0026'a str\u003e` and `Index\u003cusize\u003e`:\n\n* `Index\u003cusize\u003e` assumes the container is an array\n* `Index\u003c\u0026'a str\u003e` assumes the container is a string to value map\n* otherwise, `Yaml::BadValue` is returned\n\nIf your document does not conform to this convention (e.g. map with complex\ntype key), you can use the `Yaml::as_XXX` family API of functions to access\nyour objects.\n\n## Features\n\n* Pure Rust\n* `Vec`/`HashMap` access API\n* Low-level YAML events emission\n\n## Security\n\nThis library does not try to interpret any type specifiers in a YAML document,\nso there is no risk of, say, instantiating a socket with fields and\ncommunicating with the outside world just by parsing a YAML document.\n\n## Specification Compliance\n\nThis implementation is fully compatible with the YAML 1.2 specification. In\norder to help with compliance, `yaml-rust2` tests against (and passes) the [YAML\ntest suite](https://github.com/yaml/yaml-test-suite/).\n\n## Upgrading from yaml-rust\n\nYou can use `yaml-rust2` as a drop-in replacement for the original `yaml-rust` crate.\n\n```toml\n[dependencies]\nyaml-rust = { version = \"#.#\", package = \"yaml-rust2\" }\n```\n\nThis `Cargo.toml` declaration allows you to refer to this crate as `yaml_rust` in your code.\n\n```rust\nuse yaml_rust::{YamlLoader, YamlEmitter};\n```\n\n## License\n\nLicensed under either of\n\n * the MIT License (http://opensource.org/licenses/MIT)\n * the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n\nat your option.\n\n## Contribution\n\n[Fork this repository](https://github.com/Ethiraric/yaml-rust2/fork) and\n[Create a Pull Request on Github](https://github.com/Ethiraric/yaml-rust2/compare/master...Ethiraric:yaml-rust2:master).\nYou may need to click on \"compare across forks\" and select your fork's branch.\nMake sure that `Ethiraric` is selected as the base repository, not `chyh1990`.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n\n## Links\n\n* [yaml-rust2 source code repository](https://github.com/Ethiraric/yaml-rust2)\n\n* [yaml-rust2 releases on crates.io](https://crates.io/crates/yaml-rust2)\n\n* [yaml-rust2 documentation on docs.rs](https://docs.rs/yaml-rust2/latest/yaml_rust2/)\n\n* [yaml-test-suite](https://github.com/yaml/yaml-test-suite)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethiraric%2Fyaml-rust2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethiraric%2Fyaml-rust2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethiraric%2Fyaml-rust2/lists"}