pub struct SimClusterReceiver<T: Serialize + DeserializeOwned, O: Ordering, R: Retries>(/* private fields */);sim only.Expand description
A receiver for an external cluster stream in a simulation.
Each received value is a (u32, T) tuple where the u32 is the raw
cluster member ID that produced the value.
Implementations§
Source§impl<T: Serialize + DeserializeOwned> SimClusterReceiver<T, TotalOrder, ExactlyOnce>
impl<T: Serialize + DeserializeOwned> SimClusterReceiver<T, TotalOrder, ExactlyOnce>
Sourcepub fn next(&self, member_id: u32) -> impl use<'_, T> + Future<Output = T>
pub fn next(&self, member_id: u32) -> impl use<'_, T> + Future<Output = T>
Receives the next value from a specific cluster member, waiting (and letting the scheduler run any pending simulation work) until one is available. If the simulation becomes quiescent without producing a value, the test fails.
This is safe to use in the middle of a test; to observe the absence of a value,
use Self::try_next.
Sourcepub async fn try_next(&self, member_id: u32) -> Option<T>
pub async fn try_next(&self, member_id: u32) -> Option<T>
Receives the next value from a specific cluster member, or returns None if no more
values can possibly arrive.
If answering requires forcing pending nondeterministic work to run, then afterwards,
sending more input and then attempting to receive output will panic. Prefer
Self::next when possible.
Sourcepub async fn collect<C: Default + Extend<T>>(self, member_id: u32) -> C
pub async fn collect<C: Default + Extend<T>>(self, member_id: u32) -> C
Collects all remaining values from a specific cluster member into a collection, waiting until no more values can possibly arrive.
If this has to force pending nondeterministic work to run, it should be the last
observation of the test; see SimReceiver::collect.
Source§impl<T: Serialize + DeserializeOwned> SimClusterReceiver<T, NoOrder, ExactlyOnce>
impl<T: Serialize + DeserializeOwned> SimClusterReceiver<T, NoOrder, ExactlyOnce>
Sourcepub fn collect_n_sorted<C: Default + Extend<T> + AsMut<[T]>>(
&self,
member_id: u32,
n: usize,
) -> impl use<'_, T, C> + Future<Output = C>where
T: Ord,
pub fn collect_n_sorted<C: Default + Extend<T> + AsMut<[T]>>(
&self,
member_id: u32,
n: usize,
) -> impl use<'_, T, C> + Future<Output = C>where
T: Ord,
Receives the next n values from a specific cluster member, sorted, waiting (and
letting the scheduler run any pending simulation work) until they are available. If
the simulation becomes quiescent before n values arrive, the test fails.
Like SimReceiver::next, this is safe to use in the middle of a test.
Sourcepub async fn collect_sorted<C: Default + Extend<T> + AsMut<[T]>>(
self,
member_id: u32,
) -> Cwhere
T: Ord,
pub async fn collect_sorted<C: Default + Extend<T> + AsMut<[T]>>(
self,
member_id: u32,
) -> Cwhere
T: Ord,
Collects all remaining values from a specific cluster member, sorted, waiting until no more values can possibly arrive.
If this has to force pending nondeterministic work to run, it should be the last
observation of the test; see SimReceiver::collect.
Trait Implementations§
Source§impl<T: Serialize + DeserializeOwned, O: Ordering, R: Retries> Clone for SimClusterReceiver<T, O, R>
impl<T: Serialize + DeserializeOwned, O: Ordering, R: Retries> Clone for SimClusterReceiver<T, O, R>
impl<T: Serialize + DeserializeOwned, O: Ordering, R: Retries> Copy for SimClusterReceiver<T, O, R>
Auto Trait Implementations§
impl<T, O, R> Freeze for SimClusterReceiver<T, O, R>
impl<T, O, R> RefUnwindSafe for SimClusterReceiver<T, O, R>
impl<T, O, R> Send for SimClusterReceiver<T, O, R>
impl<T, O, R> Sync for SimClusterReceiver<T, O, R>
impl<T, O, R> Unpin for SimClusterReceiver<T, O, R>
impl<T, O, R> UnsafeUnpin for SimClusterReceiver<T, O, R>
impl<T, O, R> UnwindSafe for SimClusterReceiver<T, O, R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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