{"id":18100386,"url":"https://github.com/acatton/serde-yaml-ng","last_synced_at":"2025-04-13T16:09:31.730Z","repository":{"id":238027639,"uuid":"795720278","full_name":"acatton/serde-yaml-ng","owner":"acatton","description":"Strongly typed YAML library for Rust, serde compatible. This is an independant continuation of serde-yaml from dtolnay.","archived":false,"fork":false,"pushed_at":"2024-11-08T11:21:55.000Z","size":1374,"stargazers_count":51,"open_issues_count":14,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T16:09:26.276Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acatton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-03T22:15:20.000Z","updated_at":"2025-04-09T09:12:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d2cba6f-c48e-456e-a7aa-8970c226da96","html_url":"https://github.com/acatton/serde-yaml-ng","commit_stats":null,"previous_names":["acatton/serde-yaml-ng"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fserde-yaml-ng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fserde-yaml-ng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fserde-yaml-ng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acatton%2Fserde-yaml-ng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acatton","download_url":"https://codeload.github.com/acatton/serde-yaml-ng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741204,"owners_count":21154255,"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":[],"created_at":"2024-10-31T21:14:00.950Z","updated_at":"2025-04-13T16:09:31.707Z","avatar_url":"https://github.com/acatton.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"Serde YAML\n==========\n\n[\u003cimg alt=\"github\" src=\"https://img.shields.io/badge/github-acatton/serde--yaml--ng-8da0cb?style=for-the-badge\u0026labelColor=555555\u0026logo=github\" height=\"20\"\u003e](https://github.com/acatton/serde-yaml-ng)\n[\u003cimg alt=\"crates.io\" src=\"https://img.shields.io/crates/v/serde_yaml_ng.svg?style=for-the-badge\u0026color=fc8d62\u0026logo=rust\" height=\"20\"\u003e](https://crates.io/crates/serde_yaml_ng)\n[\u003cimg alt=\"docs.rs\" src=\"https://img.shields.io/badge/docs.rs-serde__yaml__ng-66c2a5?style=for-the-badge\u0026labelColor=555555\u0026logo=docs.rs\" height=\"20\"\u003e](https://docs.rs/serde_yaml_ng)\n[\u003cimg alt=\"build status\" src=\"https://img.shields.io/github/actions/workflow/status/acatton/serde-yaml-ng/ci.yml?branch=master\u0026style=for-the-badge\" height=\"20\"\u003e](https://github.com/acatton/serde-yaml-ng/actions?query=branch%3Amaster)\n\nRust library for using the [Serde] serialization framework with data in [YAML]\nfile format. This library only follows the [YAML specification 1.1.](https://yaml.org/spec/1.1/).\n\nThis library is a fork from the latest commit of [serde-yaml](https://github.com/dtolnay/serde-yaml),\nwhich was `200950`.\n\u003csup\u003e\\[[original](https://github.com/dtolnay/serde-yaml/commit/2009506d33767dfc88e979d6bc0d53d09f941c94)\\]\u003c/sup\u003e\n\u003csup\u003e\\[[this project](https://github.com/acatton/serde-yaml-ng/commit/2009506d33767dfc88e979d6bc0d53d09f941c94)\\]\u003c/sup\u003e\nMy goal is to be compatible as much as possible with [David Tolnay](https://github.com/dtolnay)'s original library.\n\n[Serde]: https://github.com/serde-rs/serde\n[YAML]: https://yaml.org/\n\n## Dependency\n\n```toml\n[dependencies]\nserde = \"1.0\"\nserde_yaml_ng = \"0.10\"\n```\n\nRelease notes are available under [GitHub releases].\n\n[GitHub releases]: https://github.com/acatton/serde-yaml-ng/releases\n\n## Using Serde YAML\n\n[API documentation is available in rustdoc form][docs.rs] but the general idea\nis:\n\n[docs.rs]: https://docs.rs/serde_yaml_ng\n\n```rust\nuse std::collections::BTreeMap;\n\nfn main() -\u003e Result\u003c(), serde_yaml_ng::Error\u003e {\n    // You have some type.\n    let mut map = BTreeMap::new();\n    map.insert(\"x\".to_string(), 1.0);\n    map.insert(\"y\".to_string(), 2.0);\n\n    // Serialize it to a YAML string.\n    let yaml = serde_yaml_ng::to_string(\u0026map)?;\n    assert_eq!(yaml, \"x: 1.0\\ny: 2.0\\n\");\n\n    // Deserialize it back to a Rust type.\n    let deserialized_map: BTreeMap\u003cString, f64\u003e = serde_yaml_ng::from_str(\u0026yaml)?;\n    assert_eq!(map, deserialized_map);\n    Ok(())\n}\n```\n\nIt can also be used with Serde's derive macros to handle structs and enums\ndefined in your program.\n\n```toml\n[dependencies]\nserde = { version = \"1.0\", features = [\"derive\"] }\nserde_yaml_ng = \"0.10\"\n```\n\nStructs serialize in the obvious way:\n\n```rust\nuse serde::{Serialize, Deserialize};\n\n#[derive(Debug, PartialEq, Serialize, Deserialize)]\nstruct Point {\n    x: f64,\n    y: f64,\n}\n\nfn main() -\u003e Result\u003c(), serde_yaml_ng::Error\u003e {\n    let point = Point { x: 1.0, y: 2.0 };\n\n    let yaml = serde_yaml_ng::to_string(\u0026point)?;\n    assert_eq!(yaml, \"x: 1.0\\ny: 2.0\\n\");\n\n    let deserialized_point: Point = serde_yaml_ng::from_str(\u0026yaml)?;\n    assert_eq!(point, deserialized_point);\n    Ok(())\n}\n```\n\nEnums serialize using YAML's `!tag` syntax to identify the variant name.\n\n```rust\nuse serde::{Serialize, Deserialize};\n\n#[derive(Serialize, Deserialize, PartialEq, Debug)]\nenum Enum {\n    Unit,\n    Newtype(usize),\n    Tuple(usize, usize, usize),\n    Struct { x: f64, y: f64 },\n}\n\nfn main() -\u003e Result\u003c(), serde_yaml_ng::Error\u003e {\n    let yaml = \"\n        - !Newtype 1\n        - !Tuple [0, 0, 0]\n        - !Struct {x: 1.0, y: 2.0}\n    \";\n    let values: Vec\u003cEnum\u003e = serde_yaml_ng::from_str(yaml).unwrap();\n    assert_eq!(values[0], Enum::Newtype(1));\n    assert_eq!(values[1], Enum::Tuple(0, 0, 0));\n    assert_eq!(values[2], Enum::Struct { x: 1.0, y: 2.0 });\n\n    // The last two in YAML's block style instead:\n    let yaml = \"\n        - !Tuple\n          - 0\n          - 0\n          - 0\n        - !Struct\n          x: 1.0\n          y: 2.0\n    \";\n    let values: Vec\u003cEnum\u003e = serde_yaml_ng::from_str(yaml).unwrap();\n    assert_eq!(values[0], Enum::Tuple(0, 0, 0));\n    assert_eq!(values[1], Enum::Struct { x: 1.0, y: 2.0 });\n\n    // Variants with no data can be written using !Tag or just the string name.\n    let yaml = \"\n        - Unit  # serialization produces this one\n        - !Unit\n    \";\n    let values: Vec\u003cEnum\u003e = serde_yaml_ng::from_str(yaml).unwrap();\n    assert_eq!(values[0], Enum::Unit);\n    assert_eq!(values[1], Enum::Unit);\n\n    Ok(())\n}\n```\n\n## Why?\n\nI haven't found any good fork as of the start of this project. The best candidate was\n[serde\\_yml](https://github.com/sebastienrousseau/serde_yml) which is based on\n[a giant \"Initial commit\" from the main maintainer](https://github.com/sebastienrousseau/serde_yml/commit/4312d4a56225b223410b5133af571fd13e62f18a).\nThis is the type of practices which leads to [security disasters](https://en.wikipedia.org/wiki/XZ_Utils_backdoor).\n\nI don't want to fight with people about their practices, that's why I'm\nmaintaining this library for myself, and for the rust ecosystem as a whole.\nAs we say in French: \"*You are never better served than by yourself*\". 😉\n\nUse it, don't use it, I don't care. I'll try to fix as many bugs as I can.\nI'll accept pull requests if they're reasonable or easy to work with.\n\n## Financial Support\n\nI'm a guy working out of his garage at night with a well-paid job during the day. I\ndo not need your money. **Please! Instead, give money to\n[David Tolnay](https://github.com/dtolnay).** This guy\n[carries half of the Rust ecosystem on his shoulders](https://crates.io/users/dtolnay),\nand wrote most of the code for this project before I forked it. I'm just a\nloser who jumped on the train, don't give me any money.\n\n## License\n\nLicensed \u003ca href=\"LICENSE-MIT\"\u003eMIT license\u003c/a\u003e.\n\nAny contribution must be accompanied with a signature of the\n[Developer Certificate of Origin](https://developercertificate.org/),\nby using the `--signoff` flag on `git commit`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facatton%2Fserde-yaml-ng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facatton%2Fserde-yaml-ng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facatton%2Fserde-yaml-ng/lists"}