Trait CombineReaders

Source
pub trait CombineReaders {
    type ToBeRead<'b>;

    // Required methods
    fn read<U>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> U) -> U;
    async fn wait_for_update(&mut self) -> &mut Self;
}
Expand description

Allows combining (nearly) arbitrary amounts of Readers, ExclusiveReaders or InitializedReaders.

Required Associated Types§

Source

type ToBeRead<'b>

The (tuple) value that will be read from the combined readers.

Required Methods§

Source

fn read<U>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> U) -> U

Reads a tuple of values from all combined readers in the provided function.

Source

async fn wait_for_update(&mut self) -> &mut Self

Observes the combined readers for updates.

Will return if any of the readers is updated.

This returns &mut Self to allow chaining a call to read.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T, U> CombineReaders for (&mut T, &mut U)

Source§

type ToBeRead<'x> = (&'x <T as CombinableReader>::ToBeRead, &'x <U as CombinableReader>::ToBeRead)

Source§

fn read<A>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> A) -> A

Source§

async fn wait_for_update(&mut self) -> &mut Self

Source§

impl<T, U, V> CombineReaders for (&mut T, &mut U, &mut V)

Source§

type ToBeRead<'x> = (&'x <T as CombinableReader>::ToBeRead, &'x <U as CombinableReader>::ToBeRead, &'x <V as CombinableReader>::ToBeRead)

Source§

fn read<A>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> A) -> A

Source§

async fn wait_for_update(&mut self) -> &mut Self

Source§

impl<T, U, V, W> CombineReaders for (&mut T, &mut U, &mut V, &mut W)

Source§

type ToBeRead<'x> = (&'x <T as CombinableReader>::ToBeRead, &'x <U as CombinableReader>::ToBeRead, &'x <V as CombinableReader>::ToBeRead, &'x <W as CombinableReader>::ToBeRead)

Source§

fn read<A>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> A) -> A

Source§

async fn wait_for_update(&mut self) -> &mut Self

Source§

impl<T, U, V, W, X> CombineReaders for (&mut T, &mut U, &mut V, &mut W, &mut X)

Source§

type ToBeRead<'x> = (&'x <T as CombinableReader>::ToBeRead, &'x <U as CombinableReader>::ToBeRead, &'x <V as CombinableReader>::ToBeRead, &'x <W as CombinableReader>::ToBeRead, &'x <X as CombinableReader>::ToBeRead)

Source§

fn read<A>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> A) -> A

Source§

async fn wait_for_update(&mut self) -> &mut Self

Source§

impl<T, U, V, W, X, Y> CombineReaders for (&mut T, &mut U, &mut V, &mut W, &mut X, &mut Y)

Source§

type ToBeRead<'x> = (&'x <T as CombinableReader>::ToBeRead, &'x <U as CombinableReader>::ToBeRead, &'x <V as CombinableReader>::ToBeRead, &'x <W as CombinableReader>::ToBeRead, &'x <X as CombinableReader>::ToBeRead, &'x <Y as CombinableReader>::ToBeRead)

Source§

fn read<A>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> A) -> A

Source§

async fn wait_for_update(&mut self) -> &mut Self

Source§

impl<T, U, V, W, X, Y, Z> CombineReaders for (&mut T, &mut U, &mut V, &mut W, &mut X, &mut Y, &mut Z)

Source§

type ToBeRead<'x> = (&'x <T as CombinableReader>::ToBeRead, &'x <U as CombinableReader>::ToBeRead, &'x <V as CombinableReader>::ToBeRead, &'x <W as CombinableReader>::ToBeRead, &'x <X as CombinableReader>::ToBeRead, &'x <Y as CombinableReader>::ToBeRead, &'x <Z as CombinableReader>::ToBeRead)

Source§

fn read<A>(&self, f: impl FnOnce(Self::ToBeRead<'_>) -> A) -> A

Source§

async fn wait_for_update(&mut self) -> &mut Self

Implementors§