Trait bagpipe::bag::SharedWeakBag
[−]
[src]
pub trait SharedWeakBag { type Item; fn new() -> Self; fn try_push(&self, it: Self::Item) -> Result<(), Self::Item>; fn try_pop(&self) -> PopResult<Self::Item>; fn push(&self, it: Self::Item) { ... } fn pop(&self) -> Option<Self::Item> { ... } fn debug(&self) { ... } }
A best-effort Bag data-structure.
As embodied in the PopResult
definition, try_pop
is permitted to
fail even if the bag in question is not empty.
Associated Types
type Item
Required Methods
fn new() -> Self
Returns a new instance of the data-structure.
fn try_push(&self, it: Self::Item) -> Result<(), Self::Item>
Attempts to push it
onto the data-structure.
If successful, try_push
will return true
.
fn try_pop(&self) -> PopResult<Self::Item>
Attempts to pop a value from the data-structure.
There is no guaranteed ordering of popped values. This method may fail arbitrarily even if there are accessible values in the data-structure.
Provided Methods
fn push(&self, it: Self::Item)
A push operation that will not fail.
The default implementation of push
simply calls try_push
in a loop. until it succeeds. Depending on the underlying
data-structure this may loop infinitely under some
circumstances.
push
also creates a Guard
for the duration of the function
to avoid excessive checking in the hot loop.
fn pop(&self) -> Option<Self::Item>
A pop operation that will not fail.
Same caveats apply to those of push
.
fn debug(&self)
Implementors
impl<T: Node> SharedWeakBag for YangCrummeyQueue<T> type Item = T;
impl<T: Node, F: RevokeFunc<T> + 'static> SharedWeakBag for FAAQueueLowLevel<T, F> type Item = T;
impl<T: Sized> SharedWeakBag for GeneralYC<T> type Item = T;
impl<T: Sized> SharedWeakBag for FAAArrayQueue<T> type Item = T;
impl<T> SharedWeakBag for TreiberStack<T> type Item = T;
impl<T> SharedWeakBag for SegQueue<T> type Item = T;
impl<T> SharedWeakBag for MsQueue<T> type Item = T;