Function exec_rs::invoke[][src]

pub fn invoke<'f, T: 'f, F: FnOnce() -> T + 'f>(
    mode: &Mode<'f, T>,
    task: F
) -> T

Function that implements using a reference to a Mode to invoke a task.

Uses the iterator returned by calling ModeCombiner::iter on the ModeCombiner created by the last Mode::with invocation to unwrap the ModeCombiner inside out and wrap the submitted task using ModeWrapper::wrap at each step.

Then calls the produced task or simply calls the submitted task if no ModeWrapper has been supplied to the Mode.

Mode::with consumes the supplied ModeWrapper to produce a ModeCombiner. The ModeCombiner is set on the Mode and, if there already is a ModeCombiner present, combined with the existing ModeCombiner by calling ModeCombiner::combine. By default this produces a DelegatingModeCombiner that combines ModeCombiners by setting the current ModeCombiner as the outer ModeCombiner of the newly added 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.