str-ctx 0.0.1

Simple string context map
Documentation
  • Coverage
  • 100%
    3 out of 3 items documented1 out of 3 items with examples
  • Size
  • Source code size: 16.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.13 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • holochain/str-ctx
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • neonphog

Simple string context map.

let ctx = StrCtx::from_iter([("hello", "zombies")]);
assert_eq!("[hello:zombies]", &format!("{ctx}"));

let ctx = ctx.derive([("friend", "apple")]);
assert_eq!("[friend:apple,hello:zombies]", &format!("{ctx}"));

let ctx = ctx.derive([("hello", "world")]);
assert_eq!("[friend:apple,hello:world]", &format!("{ctx}"));

let ctx: Vec<(&'static str, String)> = ctx.into_iter().collect();
assert_eq!(
    &[("friend", "apple".into()), ("hello", "world".into())],
    ctx.as_slice(),
);