pub struct Linearizer<T> { /* private fields */ }Expand description
Utility to convert the input of N senders of ordered data into 1 stream of ordered data.
Implementations§
Source§impl<T: Ord> Linearizer<T>
impl<T: Ord> Linearizer<T>
pub fn new(num_inserters: usize, buffer_size: usize) -> (Self, Vec<Inserter<T>>)
pub fn new_with_maintain_order( num_inserters: usize, buffer_size: usize, maintain_order: bool, ) -> (Self, Vec<Inserter<T>>)
Sourcepub async fn get(&mut self) -> Option<T>
pub async fn get(&mut self) -> Option<T>
Fetch the next ordered item produced by senders.
This may wait for at each sender to have sent at least one value before the Linearizer
starts producing.
If all senders have closed their channels and there are no more buffered values, this
returns None.
Auto Trait Implementations§
impl<T> Freeze for Linearizer<T>
impl<T> RefUnwindSafe for Linearizer<T>where
T: RefUnwindSafe,
impl<T> Send for Linearizer<T>where
T: Send,
impl<T> Sync for Linearizer<T>
impl<T> Unpin for Linearizer<T>where
T: Unpin,
impl<T> UnsafeUnpin for Linearizer<T>
impl<T> UnwindSafe for Linearizer<T>where
T: UnwindSafe,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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