/// Remove the value at the given index in the slab, returning `true` if a
/// value was removed.
///
/// Unlike [`take`], this method does _not_ block the current thread until
/// the value can be removed. Instead, if another thread is currently
/// accessing that value, this marks it to be removed by that thread when it
/// finishes accessing the value.
///
/// # Examples
///
/// ```rust
/// let slab = sharded_slab::Slab::new();
/// let key = slab.insert("hello world").unwrap();
///
/// // Remove the item from the slab.
/// assert!(slab.remove(key));
///
/// // 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 be removed by thread2 when it finishes accessing it.
/// assert!(slab.remove(key));
///
/// thread2.join().unwrap();
/// assert!(!slab.contains(key));
/// ```
/// [`take`]: Slab::take
Remove the value at the given index in the slab, returning `true` if a
value was removed.

Unlike [`take`], this method does _not_ block the current thread until
the value can be removed. Instead, if another thread is currently
accessing that value, this marks it to be removed by that thread when it
finishes accessing the value.
Remove the value at the given index in the slab returning ` true ` if a value was removed . Unlike [ ` take ` ] this method does _not_ block the current thread until the value can be removed . Instead if another thread is currently accessing that value this marks it to be removed by that thread when it finishes accessing the value .
pub fn remove(&self, idx: usize) -> bool {
        // The `Drop` impl for `Entry` calls `remove_local` or `remove_remote` based
        // on where the guard was dropped from. If the dropped guard was the last one, this will
        // call `Slot::remove_value` which actually clears storage.
        let tid = C::unpack_tid(idx);
        test_println!("rm_deferred {:?}", tid);
        let shard = self.shards.get(tid.as_usize());
        if tid.is_current() {
            shard.map(|shard| shard.remove_local(idx)).unwrap_or(false)
        } else {
            shard.map(|shard| shard.remove_remote(idx)).unwrap_or(false)
        }
    }
pub fn remove ( & self , idx : usize ) -> bool { // The `Drop` impl for `Entry` calls `remove_local` or `remove_remote` based // on where the guard was dropped from. If the dropped guard was the last one, this will // call `Slot::remove_value` which actually clears storage. let tid = C :: unpack_tid ( idx ) ; test_println ! ( " " tid ) ; let shard = self . shards . get ( tid . as_usize ( ) ) ; if tid . is_current ( ) { shard . map ( | shard | shard . remove_local ( idx ) ) . unwrap_or ( false ) } else { shard . map ( | shard | shard . remove_remote ( idx ) ) . unwrap_or ( false ) } }
Remove the value at the given index in the slab, returning `true` if a
value was removed.
Remove the value at the given index in the slab returning ` true ` if a value was removed .
&self
idx
usize
examples
```rust
let slab = sharded_slab::Slab::new();
let key = slab.insert("hello world").unwrap().

Remove the item from the slab.
assert!(slab.remove(key)).

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 be removed by thread2 when it finishes accessing it.
assert!(slab.remove(key)).

thread2.join().unwrap();
assert!(!slab.contains(key));
```
[`take`]: Slab::take
` ` ` rust let slab = sharded_slab :: Slab :: new () ; let key = slab . insert ( " hello world " ) . unwrap () . Remove the item from the slab . assert! ( slab . remove ( key )) . 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 be removed by thread2 when it finishes accessing it . assert! ( slab . remove ( key )) . thread2 . join () . unwrap () ; assert! ( !slab . contains ( key )) ; ` ` ` [ ` take ` ] : Slab :: take