#[cfg(feature = "dedup")]
use contain::DeduplicatingContainer;
#[cfg(feature = "dedup")]
fn append_thing<'a>(container: &'a DeduplicatingContainer<'_, String>, s: &str) -> &'a str {
container.put(format!("{}thing", s))
}
#[cfg(feature = "dedup")]
fn main() {
let container = DeduplicatingContainer::new();
let a = append_thing(&container, "some");
let b = append_thing(&container, "a ");
let c = append_thing(&container, "some");
assert_eq!(a, "something");
assert_eq!(b, "a thing");
assert_eq!(c, "something");
assert_eq!(container.count(), 2);
}
#[cfg(not(feature = "dedup"))]
fn main() {
eprintln!(
"Enable the dedup feature: cargo run --example deduplicating_container --features dedup"
);
}