pub fn insert(&self, value: T) -> Option<usize> {
        let (tid, shard) = self.shards.current();
        test_println!("insert {:?}", tid);
        let mut value = Some(value);
        shard
            .init_with(|idx, slot| {
                let gen = slot.insert(&mut value)?;
                Some(gen.pack(idx))
            })
            .map(|idx| tid.pack(idx))
    }
/// Inserts a value into the slab, returning the integer index at which that
/// value was inserted. This index can then be used to access the entry.
///
/// If this function returns `None`, then the shard for the current thread
/// is full and no items can be added until some are removed, or the maximum
/// number of shards has been reached.
///
/// # Examples
/// ```rust
/// # use sharded_slab::Slab;
/// let slab = Slab::new();
///
/// let key = slab.insert("hello world").unwrap();
/// assert_eq!(slab.get(key).unwrap(), "hello world");
/// ```
Inserts a value into the slab, returning the integer index at which that
value was inserted. This index can then be used to access the entry.

If this function returns `None`, then the shard for the current thread
is full and no items can be added until some are removed, or the maximum
number of shards has been reached.
Inserts a value into the slab returning the integer index at which that value was inserted . This index can then be used to access the entry . If this function returns ` None ` then the shard for the current thread is full and no items can be added until some are removed or the maximum number of shards has been reached .
pub fn insert(&self, value: T) -> Option<usize> {
        let (tid, shard) = self.shards.current();
        test_println!("insert {:?}", tid);
        let mut value = Some(value);
        shard
            .init_with(|idx, slot| {
                let gen = slot.insert(&mut value)?;
                Some(gen.pack(idx))
            })
            .map(|idx| tid.pack(idx))
    }
pub fn insert ( & self , value : T ) -> Option < usize > { let ( tid , shard ) = self . shards . current ( ) ; test_println ! ( " " tid ) ; let mut value = Some ( value ) ; shard . init_with ( | idx , slot | { let gen = slot . insert ( & mut value ) ? ; Some ( gen . pack ( idx ) ) } ) . map ( | idx | tid . pack ( idx ) ) }
Inserts a value into the slab, returning the integer index at which that
value was inserted.
Inserts a value into the slab returning the integer index at which that value was inserted .
&self
value
T
&self
value
T
examples
None
use sharded_slab::slab;
let slab = Slab::new().

let key = slab.insert("hello world").unwrap();
assert_eq!(slab.get(key).unwrap(), "hello world");
```
let slab = Slab :: new () . let key = slab . insert ( " hello world " ) . unwrap () ; assert_eq! ( slab . get ( key ) . unwrap () " hello world " ) ; ` ` `