[][src]Struct thread_tree::ThreadTreeCtx

pub struct ThreadTreeCtx<'a> { /* fields omitted */ }

A level-specific handle to the thread tree, that can be used to inject jobs.

See ThreadTree::top() for more information.

Implementations

impl ThreadTreeCtx<'_>[src]

pub fn is_parallel(&self) -> bool[src]

Return true if this level will parallelize in join (or if we are at the bottom of the tree)

pub fn join<A, B, RA, RB>(&self, a: A, b: B) -> (RA, RB) where
    A: FnOnce(ThreadTreeCtx<'_>) -> RA + Send,
    B: FnOnce(ThreadTreeCtx<'_>) -> RB + Send,
    RA: Send,
    RB: Send
[src]

Branch out and run a and b simultaneously and return their results jointly.

Job a runs on the current thread while b runs on the sibling thread; each is passed a lower level of the thread tree. If the bottom of the tree is reached, where no sibling threads are available, both a and b run on the current thread.

If either a or b panics, the panic is propagated here. If both jobs are executing, the panic will not propagate until after both jobs have finished.

Warning: You must not .join() into the same tree from nested jobs. Nested jobs must be spawned using the context that each job receives as the first parameter.

pub fn join3l<A, RA>(&self, a: &A) -> ((RA, RA), RA) where
    A: Fn(ThreadTreeCtx<'_>, usize) -> RA + Sync,
    RA: Send
[src]

Branch out twice and join, running three different jobs

Branches twice on the left side and once on the right. The closure is called with corresponding thread tree context and an index in 0..3 for the job.

pub fn join3r<A, RA>(&self, a: &A) -> (RA, (RA, RA)) where
    A: Fn(ThreadTreeCtx<'_>, usize) -> RA + Sync,
    RA: Send
[src]

Branch out twice and join, running three different jobs

Branches once on the right side and twice on the right. The closure is called with corresponding thread tree context and an index in 0..3 for the job.

pub fn join4<A, RA>(&self, a: &A) -> ((RA, RA), (RA, RA)) where
    A: Fn(ThreadTreeCtx<'_>, usize) -> RA + Sync,
    RA: Send
[src]

Branch out twice and join, running four different jobs.

Branches twice on each side. The closure is called with corresponding thread tree context and an index in 0..4 for the job.

Trait Implementations

impl<'a> Clone for ThreadTreeCtx<'a>[src]

impl<'a> Copy for ThreadTreeCtx<'a>[src]

impl<'a> Debug for ThreadTreeCtx<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for ThreadTreeCtx<'a>[src]

impl<'a> !Send for ThreadTreeCtx<'a>[src]

impl<'a> !Sync for ThreadTreeCtx<'a>[src]

impl<'a> Unpin for ThreadTreeCtx<'a>[src]

impl<'a> UnwindSafe for ThreadTreeCtx<'a>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.