pub struct AsyncThread { /* private fields */ }Expand description
Wraps a Lua coroutine as a Rust Future.
Drives the coroutine to completion by repeatedly resuming it and polling
any pending async futures. The coroutine’s LuaState is rooted in the
VM registry to prevent garbage collection while the AsyncThread is alive.
§Safety
AsyncThreadis!Sendand!Sync(contains raw pointer toLuaVM).- Must be polled from the same thread that created it.
- The
LuaVMmust outlive theAsyncThread.
§Example
ⓘ
let async_thread = vm.create_async_thread(chunk)?;
let results = async_thread.await?;Trait Implementations§
Source§impl Drop for AsyncThread
impl Drop for AsyncThread
Source§impl Future for AsyncThread
impl Future for AsyncThread
Auto Trait Implementations§
impl Freeze for AsyncThread
impl !RefUnwindSafe for AsyncThread
impl !Send for AsyncThread
impl !Sync for AsyncThread
impl Unpin for AsyncThread
impl UnsafeUnpin for AsyncThread
impl !UnwindSafe for AsyncThread
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
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more