#yaml #hash-map #merge #capabilities #file #alias #merge-update

merge-yaml-hash

YAML Hash with merge/update capabilities

5 unstable releases

0.3.0 Nov 21, 2023
0.2.0 Oct 18, 2019
0.1.3 Oct 15, 2019
0.1.2 Oct 15, 2019
0.1.1 Oct 15, 2019

#496 in Encoding

Download history 12/week @ 2023-12-14 43/week @ 2023-12-21 18/week @ 2023-12-28 11/week @ 2024-01-04 38/week @ 2024-01-11 29/week @ 2024-01-18 747/week @ 2024-01-25 83/week @ 2024-02-01 165/week @ 2024-02-08 143/week @ 2024-02-15 89/week @ 2024-02-22 137/week @ 2024-02-29 77/week @ 2024-03-07 249/week @ 2024-03-14 198/week @ 2024-03-21 68/week @ 2024-03-28

627 downloads per month
Used in 3 crates (2 directly)

MIT license

12KB
218 lines

About

YAML Hash with merge/update capabilities

Wrapper around yaml_rust::yaml::Hash, which is a type alias for linked_hash_map::LinkedHashMap

Example

use merge_yaml_hash::{MergeYamlHash, Yaml};

let mut hash = MergeYamlHash::new();

// Merge YAML data from strings
hash.merge("apple: 1\nbanana: 2");
hash.merge("cherry:\n  sweet: 1\n  tart: 2");
assert_eq!(
    hash.to_string(),
    "apple: 1\nbanana: 2\ncherry:\n  sweet: 1\n  tart: 2",
);

// Merge YAML data from file
// * Note that insertion order is maintained
hash.merge("tests/c.yaml"); // "banana: 3"
assert_eq!(
    hash.to_string(),
    "apple: 1\nbanana: 3\ncherry:\n  sweet: 1\n  tart: 2",
);

Changelog

  • 0.1.0 (2019-10-15): initial release
  • 0.1.1-3 (2019-10-15): minor fixes
  • 0.2.0 (2019-10-18): Make data field public
  • 0.3.0 (2023-11-21): Resolve issue #1; update edition and dependencies; apply clippy suggestions; modernize

Dependencies

~185KB