pub struct Flow<T: Flows> { /* private fields */ }
Expand description
Bounded queue for publishing and receiving data from (a)synchronous tasks.
Refer to the crate docs for more info.
Implementations§
Source§impl<T: Flows> Flow<T>
impl<T: Flows> Flow<T>
Sourcepub fn new<const SUB: usize>(
capacity: usize,
) -> Result<(Self, [FlowSubscriber<T>; SUB]), Error>
pub fn new<const SUB: usize>( capacity: usize, ) -> Result<(Self, [FlowSubscriber<T>; SUB]), Error>
Returns a tuple of (flow, [subscribers])
,
where capacity
is the maximum capacity
of the flow.
Returns Err
iff capacity
is not a power
of two (like 2
, 32
, 256
, and so on).
Sourcepub fn try_next(&mut self) -> Result<UnpublishedData<'_, T>, Error>
pub fn try_next(&mut self) -> Result<UnpublishedData<'_, T>, Error>
Tries to claim the next publishable
sequence in the flow, returning
a UnpublishedData
iff successful.
Sourcepub async fn next(&mut self) -> Result<UnpublishedData<'_, T>, Error>
pub async fn next(&mut self) -> Result<UnpublishedData<'_, T>, Error>
Awaits and claims the next publishable sequence
in the flow, returning a UnpublishedData
iff successful.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Flow<T>
impl<T> !RefUnwindSafe for Flow<T>
impl<T> Send for Flow<T>
impl<T> Sync for Flow<T>
impl<T> Unpin for Flow<T>
impl<T> !UnwindSafe for Flow<T>
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
Mutably borrows from an owned value. Read more