pub struct Thread { /* private fields */ }Expand description
A thread running a local future executor (futures::executor::LocalPool).
Implementations§
Source§impl Thread
impl Thread
Sourcepub fn run<Context: Post, F: Future<Output: Post> + 'static>(
&self,
context: Context,
code: impl FnOnce(Context) -> F + Send + 'static,
) -> Task<F::Output> ⓘ
pub fn run<Context: Post, F: Future<Output: Post> + 'static>( &self, context: Context, code: impl FnOnce(Context) -> F + Send + 'static, ) -> Task<F::Output> ⓘ
Execute a function on a thread.
The function will begin executing immediately. The resulting
Task can be awaited to retrieve the result.
Sourcepub fn run_send<Context: Post, F: Future<Output: Send> + 'static>(
&self,
context: Context,
code: impl FnOnce(Context) -> F + Send + 'static,
) -> SendTask<F::Output> ⓘ
pub fn run_send<Context: Post, F: Future<Output: Send> + 'static>( &self, context: Context, code: impl FnOnce(Context) -> F + Send + 'static, ) -> SendTask<F::Output> ⓘ
Like Thread::run, but the output can be sent through Rust
memory without Posting.
In this shim, this is equivalent to Thread::run.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Thread
impl !RefUnwindSafe for Thread
impl Send for Thread
impl Sync for Thread
impl Unpin for Thread
impl !UnwindSafe for Thread
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