1 unstable release
0.0.1 | Jun 13, 2024 |
---|
#48 in #debug
7KB
69 lines
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(),
);
lib.rs
:
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(),
);