4 releases

Uses old Rust 2015

0.2.3 Jul 19, 2017
0.2.2 Jul 12, 2017
0.2.1 Dec 5, 2016
0.2.0 Dec 5, 2016
0.1.0 Dec 4, 2016

#9 in #interning

Download history 15/week @ 2020-10-28 19/week @ 2020-11-04 10/week @ 2020-11-11 10/week @ 2020-11-18 19/week @ 2020-11-25 15/week @ 2020-12-02 14/week @ 2020-12-09 6/week @ 2020-12-16 4/week @ 2020-12-23 4/week @ 2020-12-30 16/week @ 2021-01-06 15/week @ 2021-01-13 11/week @ 2021-01-20 8/week @ 2021-01-27 8/week @ 2021-02-03 35/week @ 2021-02-10

77 downloads per month
Used in 2 crates (via cov)

MIT license

32KB
459 lines

shawshank

An efficient, generic internment structure.

Travis-CI Status Crates.io License

extern crate shawshank;

fn main() {
    // prototypical motivation: string internment
    let mut sp = shawshank::string_arena_set();
    assert_eq!(sp.intern("hello"), Ok(0));
    assert_eq!(sp.intern("world"), Ok(1));
    assert_eq!(sp.intern("hello"), Ok(0));
    assert_eq!(sp.resolve(1), Ok("world"));

    // byte vectors work, too
    let mut bp = shawshank::byte_arena_set();
    assert_eq!(bp.intern(&[0, 1, 2][..]), Ok(0));

    // even Box<T>
    let mut p = shawshank::builder::<Box<u8>>().hash().unwrap();
    assert_eq!(p.intern(255), Ok(0));

    // BTreeMap instead of default HashMap
    let mut bsp = shawshank::builder::<String>().btree().unwrap();
    assert_eq!(bsp.intern("foo"), Ok(0));
}

For more details, see the docs.

Dependencies

~215KB