Struct workerpool::thunk::Thunk
source · pub struct Thunk<'a, T>(/* private fields */);
Expand description
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);
Implementations§
Auto Trait Implementations§
impl<'a, T> !RefUnwindSafe for Thunk<'a, T>
impl<'a, T> Send for Thunk<'a, T>
impl<'a, T> !Sync for Thunk<'a, T>
impl<'a, T> Unpin for Thunk<'a, T>
impl<'a, T> !UnwindSafe for Thunk<'a, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more