str-ctx

Crates.iostr-ctx
lib.rsstr-ctx
version0.0.1
sourcesrc
created_at2024-06-13 21:39:23.482442
updated_at2024-06-13 21:39:23.482442
descriptionSimple string context map
homepage
repositoryhttps://github.com/holochain/str-ctx
max_upload_size
id1271416
size16,586
David Braden (neonphog)

documentation

https://docs.rs/str-ctx

README

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(),
);
Commit count: 1

cargo fmt