pub struct Queue<A: Send + 'static> { /* private fields */ }Expand description
Cloneable multi-producer / multi-consumer queue with several backpressure modes.
Implementations§
Source§impl<A: Send + 'static> Queue<A>
impl<A: Send + 'static> Queue<A>
Sourcepub fn bounded(capacity: usize) -> Effect<Queue<A>, (), ()>
pub fn bounded(capacity: usize) -> Effect<Queue<A>, (), ()>
Bounded queue: Queue::offer returns false when full (no blocking).
Sourcepub fn dropping(capacity: usize) -> Effect<Queue<A>, (), ()>
pub fn dropping(capacity: usize) -> Effect<Queue<A>, (), ()>
Bounded queue that drops the incoming element when full.
Sourcepub fn sliding(capacity: usize) -> Effect<Queue<A>, (), ()>
pub fn sliding(capacity: usize) -> Effect<Queue<A>, (), ()>
Fixed-capacity queue that drops the oldest element when full.
Sourcepub fn offer(&self, value: A) -> Effect<bool, (), ()>
pub fn offer(&self, value: A) -> Effect<bool, (), ()>
Try to enqueue one value. false means the value was not stored (full, dropping, or shut down).
Sourcepub fn offer_all<I>(&self, iter: I) -> Effect<Vec<A>, (), ()>
pub fn offer_all<I>(&self, iter: I) -> Effect<Vec<A>, (), ()>
Enqueue as many values as possible; returns those that could not be stored (in order).
Sourcepub fn take(&self) -> Effect<A, QueueError, ()>
pub fn take(&self) -> Effect<A, QueueError, ()>
Block until a value is available or the queue disconnects.
Sourcepub fn take_all(&self) -> Effect<Chunk<A>, QueueError, ()>
pub fn take_all(&self) -> Effect<Chunk<A>, QueueError, ()>
Wait for at least one element, then drain all currently available elements.
Sourcepub fn take_up_to(&self, n: usize) -> Effect<Chunk<A>, QueueError, ()>
pub fn take_up_to(&self, n: usize) -> Effect<Chunk<A>, QueueError, ()>
After the first element arrives, take at most n elements total (including the first).
Sourcepub fn take_n(&self, n: usize) -> Effect<Chunk<A>, QueueError, ()>
pub fn take_n(&self, n: usize) -> Effect<Chunk<A>, QueueError, ()>
Block until n separate receives complete (or disconnect).
Sourcepub fn take_between(
&self,
min: usize,
max: usize,
) -> Effect<Chunk<A>, QueueError, ()>
pub fn take_between( &self, min: usize, max: usize, ) -> Effect<Chunk<A>, QueueError, ()>
Take between min and max elements inclusive (waits for min values unless disconnected).
Sourcepub fn is_full(&self) -> Effect<bool, (), ()>
pub fn is_full(&self) -> Effect<bool, (), ()>
true when at capacity (bounded / sliding) or shut down (flume side).
Sourcepub fn shutdown(&self) -> Effect<(), (), ()>
pub fn shutdown(&self) -> Effect<(), (), ()>
Close the queue to producers; buffered values remain available to receivers.
Sourcepub fn is_shutdown(&self) -> Effect<bool, (), ()>
pub fn is_shutdown(&self) -> Effect<bool, (), ()>
true after Self::shutdown has completed.
Sourcepub fn await_shutdown(&self) -> Effect<(), (), ()>
pub fn await_shutdown(&self) -> Effect<(), (), ()>
Completes after Self::shutdown has been observed.
Trait Implementations§
Auto Trait Implementations§
impl<A> !RefUnwindSafe for Queue<A>
impl<A> !UnwindSafe for Queue<A>
impl<A> Freeze for Queue<A>
impl<A> Send for Queue<A>
impl<A> Sync for Queue<A>
impl<A> Unpin for Queue<A>
impl<A> UnsafeUnpin for Queue<A>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Capability for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more