pub struct Bag<T> { /* private fields */ }
Expand description
Bag is a lock-free concurrent unordered instance container.
Bag is a linearizable concurrent instance container where usize::BITS / 2 instances are
stored in a fixed-size array, and the rest are managed by its backup container which makes a
Bag especially efficient if the expected number of instances does not exceed
usize::BITS / 2.
Pushes an instance of T.
use scc::Bag;
let bag: Bag<usize> = Bag::default();
bag.push(11);
Pops an instance in the Bag if not empty.
use scc::Bag;
let bag: Bag<usize> = Bag::default();
bag.push(37);
assert_eq!(bag.pop(), Some(37));
assert!(bag.pop().is_none());
Returns true if the Bag is empty.
use scc::Bag;
let bag: Bag<usize> = Bag::default();
assert!(bag.is_empty());
bag.push(7);
assert!(!bag.is_empty());
assert_eq!(bag.pop(), Some(7));
assert!(bag.is_empty());
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Executes the destructor for this type.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.