Trait mlua_luau_scheduler::LuaSchedulerExt
source · pub trait LuaSchedulerExt<'lua> {
// Required methods
fn set_exit_code(&self, code: ExitCode);
fn push_thread_front(
&'lua self,
thread: impl IntoLuaThread<'lua>,
args: impl IntoLuaMulti<'lua>
) -> LuaResult<ThreadId>;
fn push_thread_back(
&'lua self,
thread: impl IntoLuaThread<'lua>,
args: impl IntoLuaMulti<'lua>
) -> LuaResult<ThreadId>;
fn track_thread(&'lua self, id: ThreadId);
fn get_thread_result(
&'lua self,
id: ThreadId
) -> Option<LuaResult<LuaMultiValue<'lua>>>;
fn wait_for_thread(&'lua self, id: ThreadId) -> impl Future<Output = ()>;
}
Expand description
Required Methods§
sourcefn set_exit_code(&self, code: ExitCode)
fn set_exit_code(&self, code: ExitCode)
Sets the exit code of the current scheduler.
See Scheduler::set_exit_code
for more information.
§Panics
Panics if called outside of a running Scheduler
.
sourcefn push_thread_front(
&'lua self,
thread: impl IntoLuaThread<'lua>,
args: impl IntoLuaMulti<'lua>
) -> LuaResult<ThreadId>
fn push_thread_front( &'lua self, thread: impl IntoLuaThread<'lua>, args: impl IntoLuaMulti<'lua> ) -> LuaResult<ThreadId>
Pushes (spawns) a lua thread to the front of the current scheduler.
See Scheduler::push_thread_front
for more information.
§Panics
Panics if called outside of a running Scheduler
.
sourcefn push_thread_back(
&'lua self,
thread: impl IntoLuaThread<'lua>,
args: impl IntoLuaMulti<'lua>
) -> LuaResult<ThreadId>
fn push_thread_back( &'lua self, thread: impl IntoLuaThread<'lua>, args: impl IntoLuaMulti<'lua> ) -> LuaResult<ThreadId>
Pushes (defers) a lua thread to the back of the current scheduler.
See Scheduler::push_thread_back
for more information.
§Panics
Panics if called outside of a running Scheduler
.
sourcefn track_thread(&'lua self, id: ThreadId)
fn track_thread(&'lua self, id: ThreadId)
Registers the given thread to be tracked within the current scheduler.
Must be called before waiting for a thread to complete or getting its result.
sourcefn get_thread_result(
&'lua self,
id: ThreadId
) -> Option<LuaResult<LuaMultiValue<'lua>>>
fn get_thread_result( &'lua self, id: ThreadId ) -> Option<LuaResult<LuaMultiValue<'lua>>>
Gets the result of the given thread.
See Scheduler::get_thread_result
for more information.
§Panics
Panics if called outside of a running Scheduler
.
sourcefn wait_for_thread(&'lua self, id: ThreadId) -> impl Future<Output = ()>
fn wait_for_thread(&'lua self, id: ThreadId) -> impl Future<Output = ()>
Waits for the given thread to complete.
See Scheduler::wait_for_thread
for more information.
§Panics
Panics if called outside of a running Scheduler
.