contain 0.5.1

A crate for defining/extending lifetimes
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use contain::SimpleContainer;

fn append_thing<'a>(container: &'a SimpleContainer<String>, s: &str) -> &'a str {
    container.put(format!("{}thing", s))
}

fn main() {
    let container = SimpleContainer::new();
    let a = append_thing(&container, "some");
    let b = append_thing(&container, "a ");
    let c = append_thing(&container, "that ");

    assert_eq!(a, "something");
    assert_eq!(b, "a thing");
    assert_eq!(c, "that thing");
    assert_eq!(container.count(), 3);
}