[][src]Struct workerpool::thunk::Thunk

pub struct Thunk<'a, T>(_);

This type represents an argumentless function with return type T that is also Sized + Send.

You can create it by wrapping such a function with Thunk::of.

Examples

let thunk: Thunk<u8> = Thunk::of(|| 127u8);
fn my_function() -> Option<String> {
    None
}
let thunk: Thunk<Option<String>> = Thunk::of(my_function);

Methods

impl<'a, T> Thunk<'a, T>[src]

pub fn of<F>(f: F) -> Self where
    F: FnOnce() -> T + Send + 'static, 
[src]

Auto Trait Implementations

impl<'a, T> Send for Thunk<'a, T>

impl<'a, T> !Sync for Thunk<'a, T>

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Erased for T