pub struct Functions {
pub resume: LuaFunction,
pub wrap: LuaFunction,
pub spawn: LuaFunction,
pub defer: LuaFunction,
pub cancel: LuaFunction,
pub exit: LuaFunction,
}Expand description
A collection of lua functions that may be called to interact with a [Scheduler].
Note that these may all be implemented using LuaSchedulerExt, however, this struct
is implemented using internal (non-public) APIs, and generally has better performance.
Fields§
§resume: LuaFunctionImplementation of coroutine.resume that handles async polling properly.
Defers onto the scheduler queue if the thread calls an async function.
wrap: LuaFunctionImplementation of coroutine.wrap that handles async polling properly.
Defers onto the scheduler queue if the thread calls an async function.
spawn: LuaFunctionResumes a function / thread once instantly, and runs until first yield.
Spawns onto the scheduler queue if not completed.
defer: LuaFunctionDefers a function / thread onto the scheduler queue.
Does not resume instantly, only adds to the queue.
cancel: LuaFunctionCancels a function / thread, removing it from the queue.
exit: LuaFunctionExits the scheduler, stopping all other threads and closing the scheduler.
Yields the calling thread to ensure that it does not continue.
Implementations§
Auto Trait Implementations§
impl Freeze for Functions
impl !RefUnwindSafe for Functions
impl !Send for Functions
impl !Sync for Functions
impl Unpin for Functions
impl !UnwindSafe for Functions
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more