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§
Sourcefn combine(
&self,
other: Box<dyn ModeCombiner<'m, T> + Send + Sync + 'm>,
) -> Box<dyn ModeCombiner<'m, T> + Send + Sync + 'm>
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.
Sourcefn get_outer(&self) -> Option<&(dyn ModeCombiner<'m, T> + Send + Sync)>
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.
Sourcefn set_outer(&mut self, outer: Arc<dyn ModeCombiner<'m, T> + Send + Sync + 'm>)
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.
Sourcefn iter<'a>(&'a self) -> ModeCombinerIterator<'a, 'm, T> ⓘ
fn iter<'a>(&'a self) -> ModeCombinerIterator<'a, 'm, T> ⓘ
Return an iterator that can unwrap combined ModeCombiners by stepping into the outer ModeCombiner recursively.
Sourcefn wrapper_ref(&self) -> Arc<dyn ModeWrapper<'m, T> + Send + Sync + 'm>
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
.