Skip to main content

CombineReaders

Trait CombineReaders 

pub trait CombineReaders {
    type ToBeRead<'b>;

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

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

Required Associated Types§

type ToBeRead<'b>

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

Required Methods§

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

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

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.

fn is_updated(&self) -> bool

Returns true if any of the readers was updated.

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§

§

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

§

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

§

fn read<A>( &mut self, f: impl FnOnce(<(&mut T, &mut U) as CombineReaders>::ToBeRead<'_>) -> A, ) -> A

§

async fn wait_for_update(&mut self) -> &mut (&mut T, &mut U)

§

fn is_updated(&self) -> bool

§

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

§

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

§

fn read<A>( &mut self, f: impl FnOnce(<(&mut T, &mut U, &mut V) as CombineReaders>::ToBeRead<'_>) -> A, ) -> A

§

async fn wait_for_update(&mut self) -> &mut (&mut T, &mut U, &mut V)

§

fn is_updated(&self) -> bool

§

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

§

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

§

fn read<A>( &mut self, f: impl FnOnce(<(&mut T, &mut U, &mut V, &mut W) as CombineReaders>::ToBeRead<'_>) -> A, ) -> A

§

async fn wait_for_update(&mut self) -> &mut (&mut T, &mut U, &mut V, &mut W)

§

fn is_updated(&self) -> bool

§

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

§

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)

§

fn read<A>( &mut self, f: impl FnOnce(<(&mut T, &mut U, &mut V, &mut W, &mut X) as CombineReaders>::ToBeRead<'_>) -> A, ) -> A

§

async fn wait_for_update( &mut self, ) -> &mut (&mut T, &mut U, &mut V, &mut W, &mut X)

§

fn is_updated(&self) -> bool

§

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

§

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)

§

fn read<A>( &mut self, f: impl FnOnce(<(&mut T, &mut U, &mut V, &mut W, &mut X, &mut Y) as CombineReaders>::ToBeRead<'_>) -> A, ) -> A

§

async fn wait_for_update( &mut self, ) -> &mut (&mut T, &mut U, &mut V, &mut W, &mut X, &mut Y)

§

fn is_updated(&self) -> bool

§

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

§

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)

§

fn read<A>( &mut self, f: impl FnOnce(<(&mut T, &mut U, &mut V, &mut W, &mut X, &mut Y, &mut Z) as CombineReaders>::ToBeRead<'_>) -> A, ) -> A

§

async fn wait_for_update( &mut self, ) -> &mut (&mut T, &mut U, &mut V, &mut W, &mut X, &mut Y, &mut Z)

§

fn is_updated(&self) -> bool

Implementors§