Skip to main content

Using

Trait Using 

Source
pub trait Using: Sync {
    type Item: 'static;

    // Required methods
    fn create(&self, thread_idx: usize) -> Self::Item;
    fn into_inner(self) -> Self::Item;
}
Expand description

A type that can create a value per thread, which will then be send to the thread, and used mutable by the defined computation.

Required Associated Types§

Source

type Item: 'static

Item to be used mutably by each threads used in parallel computation.

Required Methods§

Source

fn create(&self, thread_idx: usize) -> Self::Item

Creates an instance of the variable to be used by the thread_idx-th thread.

Source

fn into_inner(self) -> Self::Item

Consumes self and creates exactly one instance of the variable.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, T> Using for UsingFun<F, T>
where T: 'static, F: Fn(usize) -> T + Sync,

Source§

type Item = T

Source§

impl<T: Clone + 'static> Using for UsingClone<T>

Source§

type Item = T