Trait ModeCombiner

Source
pub trait ModeCombiner<'m, T: 'm> {
    // Required methods
    fn combine(
        &self,
        other: Box<dyn ModeCombiner<'m, T> + Send + Sync + 'm>,
    ) -> Box<dyn ModeCombiner<'m, T> + Send + Sync + 'm>;
    fn get_outer(&self) -> Option<&(dyn ModeCombiner<'m, T> + Send + Sync)>;
    fn set_outer(
        &mut self,
        outer: Arc<dyn ModeCombiner<'m, T> + Send + Sync + 'm>,
    );
    fn iter<'a>(&'a self) -> ModeCombinerIterator<'a, 'm, T> ;
    fn wrapper_ref(&self) -> Arc<dyn ModeWrapper<'m, T> + Send + Sync + 'm>;
}
Expand description

Trait used to combine ModeWrappers by allowing one ModeWrapper to delegate to another ModeWrapper and providing an iterator that can unwrap combined ModeWrappers. An implementation of this trait is returned by ModeWrapper::into_combiner which returns a DelegatingModeCombiner by default.

Required Methods§

Source

fn combine( &self, other: Box<dyn ModeCombiner<'m, T> + Send + Sync + 'm>, ) -> Box<dyn ModeCombiner<'m, T> + Send + Sync + 'm>

Combine this ModeCombiner with the supplied boxed ModeCombiner.

The default implementation in DelegatingModeCombiner sets this ModeCombiner as the outer ModeCombiner of the supplied ModeCombiner so that the iterator walks the ModeCombiners in the reverse order of which they were added, meaning the ModeCombiner that was added first ends up wrapping the task last, meaning its task will be the outermost task.

Source

fn get_outer(&self) -> Option<&(dyn ModeCombiner<'m, T> + Send + Sync)>

Return the outer ModeCombiner this ModeCombiner delegates to, this is the next ModeCombiner the iterator returned by ModeCombiner::iter steps to.

Source

fn set_outer(&mut self, outer: Arc<dyn ModeCombiner<'m, T> + Send + Sync + 'm>)

Set the outer ModeCombiner this ModeCombiner delegates to, this is the next ModeCombiner the iterator returned by ModeCombiner::iter steps to.

Source

fn iter<'a>(&'a self) -> ModeCombinerIterator<'a, 'm, T>

Return an iterator that can unwrap combined ModeCombiners by stepping into the outer ModeCombiner recursively.

Source

fn wrapper_ref(&self) -> Arc<dyn ModeWrapper<'m, T> + Send + Sync + 'm>

Reference the source ModeWrapper. Used to wrap the task when applying a Mode.

Implementors§

Source§

impl<'m, T> ModeCombiner<'m, T> for DelegatingModeCombiner<'m, T>