pub fn take(&self, idx: usize) -> Option<T> {
        let tid = C::unpack_tid(idx);

        test_println!("rm {:?}", tid);
        let shard = self.shards.get(tid.as_usize())?;
        if tid.is_current() {
            shard.take_local(idx)
        } else {
            shard.take_remote(idx)
        }
    }
/// Removes the value associated with the given key from the slab, returning
/// it.
///
/// If the slab does not contain a value for that key, `None` is returned
/// instead.
///
/// If the value associated with the given key is currently being
/// accessed by another thread, this method will block the current thread
/// until the item is no longer accessed. If this is not desired, use
/// [`remove`] instead.
///
/// **Note**: This method blocks the calling thread by spinning until the
/// currently outstanding references are released. Spinning for long periods
/// of time can result in high CPU time and power consumption. Therefore,
/// `take` should only be called when other references to the slot are
/// expected to be dropped soon (e.g., when all accesses are relatively
/// short).
///
/// # Examples
///
/// ```rust
/// let slab = sharded_slab::Slab::new();
/// let key = slab.insert("hello world").unwrap();
///
/// // Remove the item from the slab, returning it.
/// assert_eq!(slab.take(key), Some("hello world"));
///
/// // Now, the slot is empty.
/// assert!(!slab.contains(key));
/// ```
///
/// ```rust
/// use std::sync::Arc;
///
/// let slab = Arc::new(sharded_slab::Slab::new());
/// let key = slab.insert("hello world").unwrap();
///
/// let slab2 = slab.clone();
/// let thread2 = std::thread::spawn(move || {
///     // Depending on when this thread begins executing, the item may
///     // or may not have already been removed...
///     if let Some(item) = slab2.get(key) {
///         assert_eq!(item, "hello world");
///     }
/// });
///
/// // The item will only be removed when the other thread finishes
/// // accessing it.
/// assert_eq!(slab.take(key), Some("hello world"));
///
/// thread2.join().unwrap();
/// assert!(!slab.contains(key));
/// ```
/// [`remove`]: Slab::remove
Removes the value associated with the given key from the slab, returning
it.

If the slab does not contain a value for that key, `None` is returned
instead.

If the value associated with the given key is currently being
accessed by another thread, this method will block the current thread
until the item is no longer accessed. If this is not desired, use
[`remove`] instead.

Note**: This method blocks the calling thread by spinning until the
currently outstanding references are released. Spinning for long periods
of time can result in high CPU time and power consumption. Therefore,
`take` should only be called when other references to the slot are
expected to be dropped soon .
Removes the value associated with the given key from the slab returning it . If the slab does not contain a value for that key ` None ` is returned instead . If the value associated with the given key is currently being accessed by another thread this method will block the current thread until the item is no longer accessed . If this is not desired use [ ` remove ` ] instead . Note ** : This method blocks the calling thread by spinning until the currently outstanding references are released . Spinning for long periods of time can result in high CPU time and power consumption . Therefore ` take ` should only be called when other references to the slot are expected to be dropped soon .
pub fn take(&self, idx: usize) -> Option<T> {
        let tid = C::unpack_tid(idx);
        test_println!("rm {:?}", tid);
        let shard = self.shards.get(tid.as_usize())?;
        if tid.is_current() {
            shard.take_local(idx)
        } else {
            shard.take_remote(idx)
        }
    }
pub fn take ( & self , idx : usize ) -> Option < T > { let tid = C :: unpack_tid ( idx ) ; test_println ! ( " " tid ) ; let shard = self . shards . get ( tid . as_usize ( ) ) ? ; if tid . is_current ( ) { shard . take_local ( idx ) } else { shard . take_remote ( idx ) } }
Removes the value associated with the given key from the slab, returning
it.
Removes the value associated with the given key from the slab returning it .
&self
idx
usize
&self
idx
usize
examples
```rust
let slab = sharded_slab::Slab::new();
let key = slab.insert("hello world").unwrap().

Remove the item from the slab, returning it.
assert_eq!(slab.take(key), Some("hello world")).

Now, the slot is empty.
assert!(!slab.contains(key));
```

```rust
use std::sync::Arc.

let slab = Arc::new(sharded_slab::Slab::new());
let key = slab.insert("hello world").unwrap().

let slab2 = slab.clone();
let thread2 = std::thread::spawn(move || {
Depending on when this thread begins executing, the item may
or may not have already been removed
if let Some(item) = slab2.get(key) {
assert_eq!(item, "hello world");
}
}).

The item will only be removed when the other thread finishes
accessing it.
assert_eq!(slab.take(key), Some("hello world")).

thread2.join().unwrap();
assert!(!slab.contains(key));
```
[`remove`]: Slab::remove
` ` ` rust let slab = sharded_slab :: Slab :: new () ; let key = slab . insert ( " hello world " ) . unwrap () . Remove the item from the slab returning it . assert_eq! ( slab . take ( key ) Some ( " hello world " )) . Now the slot is empty . assert! ( !slab . contains ( key )) ; ` ` ` ` ` ` rust use std :: sync :: Arc . let slab = Arc :: new ( sharded_slab :: Slab :: new () ) ; let key = slab . insert ( " hello world " ) . unwrap () . let slab2 = slab . clone () ; let thread2 = std :: thread :: spawn ( move || { Depending on when this thread begins executing the item may or may not have already been removed if let Some ( item ) = slab2 . get ( key ) { assert_eq! ( item " hello world " ) ; } } ) . The item will only be removed when the other thread finishes accessing it . assert_eq! ( slab . take ( key ) Some ( " hello world " )) . thread2 . join () . unwrap () ; assert! ( !slab . contains ( key )) ; ` ` ` [ ` remove ` ] : Slab :: remove