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,
) -> (Self, [FlowSubscriber<T>; SUB])where
T: Default,
pub fn new<const SUB: usize>(
capacity: usize,
) -> (Self, [FlowSubscriber<T>; SUB])where
T: Default,
Returns a tuple of (flow, [subscribers])
,
where capacity
is the maximum capacity
of the flow.
§Panics
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 fn next(
&mut self,
) -> impl Future<Output = Result<UnpublishedData<'_, T>, Error>>
pub fn next( &mut self, ) -> impl Future<Output = 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> TryAsFormat<T> for T
impl<T> TryAsFormat<T> for T
Source§type Error = Infallible
type Error = Infallible
Source§fn try_as_format(&self) -> Result<&T, <T as TryAsFormat<T>>::Error>
fn try_as_format(&self) -> Result<&T, <T as TryAsFormat<T>>::Error>
Returns a
D
-formatted reference to the data.