Struct shawshank::Builder
[−]
[src]
pub struct Builder<O, I = usize> { /* fields omitted */ }
Flexible builder for ArenaSet
.
use std::sync::Arc; let b1 = shawshank::Builder::<String>::new(); let mut p1 = b1.hash().unwrap(); assert_eq!(p1.intern("hello"), Ok(0)); assert_eq!(p1.resolve(0), Ok("hello")); let b2 = shawshank::Builder::<Arc<String>>::new(); let mut p2 = b2.stadium_set_hash().unwrap(); assert_eq!(p2.intern("hello"), Ok(0)); let s: &String = p2.resolve(0).unwrap(); assert_eq!(s.as_str(), "hello");
Methods
impl<O, I> Builder<O, I>
[src]
fn new() -> Self
impl<O, I> Builder<O, I> where
O: StableDeref,
I: Bounded + ToPrimitive + FromPrimitive,
[src]
O: StableDeref,
I: Bounded + ToPrimitive + FromPrimitive,
fn hash(&self) -> Result<ArenaSet<O, I, HashMap<&'static O::Target, I>>, Error> where
O::Target: Eq + Hash,
O::Target: Eq + Hash,
Create an empty ArenaSet
that uses a HashMap
.
fn btree(
&self
) -> Result<ArenaSet<O, I, BTreeMap<&'static O::Target, I>>, Error> where
O::Target: Eq + Ord,
&self
) -> Result<ArenaSet<O, I, BTreeMap<&'static O::Target, I>>, Error> where
O::Target: Eq + Ord,
Create an empty ArenaSet
that uses a BTreeMap
.
impl<O, I> Builder<O, I> where
O: StableDeref,
O::Target: 'static + StableDeref,
<O::Target as Deref>::Target: 'static,
I: Bounded + ToPrimitive + FromPrimitive,
[src]
O: StableDeref,
O::Target: 'static + StableDeref,
<O::Target as Deref>::Target: 'static,
I: Bounded + ToPrimitive + FromPrimitive,
fn stadium_set_hash(
&self
) -> Result<StadiumSet<O, O::Target, I, HashMap<&'static <O::Target as Deref>::Target, I>>, Error> where
<O::Target as Deref>::Target: Eq + Hash,
&self
) -> Result<StadiumSet<O, O::Target, I, HashMap<&'static <O::Target as Deref>::Target, I>>, Error> where
<O::Target as Deref>::Target: Eq + Hash,
Create an empty StadiumSet
that uses a HashMap
.
fn stadium_set_btree(
&self
) -> Result<StadiumSet<O, O::Target, I, BTreeMap<&'static <O::Target as Deref>::Target, I>>, Error> where
<O::Target as Deref>::Target: Eq + Ord,
&self
) -> Result<StadiumSet<O, O::Target, I, BTreeMap<&'static <O::Target as Deref>::Target, I>>, Error> where
<O::Target as Deref>::Target: Eq + Ord,
Create an empty StadiumSet
that uses a BTreeMap
.