shawshank

Crates.ioshawshank
lib.rsshawshank
version0.2.3
sourcesrc
created_at2016-12-04 21:07:54.279388
updated_at2017-07-19 19:01:22.291273
descriptionAn efficient, generic internment structure.
homepage
repositoryhttps://github.com/kinghajj/shawshank
max_upload_size
id7463
size34,086
Samuel Fredrickson (kinghajj)

documentation

https://kinghajj.github.io/shawshank/shawshank/index.html

README

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.

Commit count: 14

cargo fmt