pub struct CommandQueue {
pub commands: Mutex<Vec<ScriptCommand>>,
}Expand description
Thread-safe queue of pending ScriptCommands, accessible from Lua callbacks.
Lua callbacks cannot mutate the World directly, so they push commands here;
the engine later drains and applies them at a controlled point in the frame.
Fields§
§commands: Mutex<Vec<ScriptCommand>>Pending commands, guarded by a mutex so Lua callbacks can push concurrently.
Implementations§
Source§impl CommandQueue
impl CommandQueue
Sourcepub fn push(&self, cmd: ScriptCommand)
pub fn push(&self, cmd: ScriptCommand)
Appends a command to the queue.
Sourcepub fn drain(&self) -> Vec<ScriptCommand>
pub fn drain(&self) -> Vec<ScriptCommand>
Removes and returns all currently queued commands, leaving the queue empty.
Trait Implementations§
Source§impl Debug for CommandQueue
impl Debug for CommandQueue
Source§impl Default for CommandQueue
impl Default for CommandQueue
Source§fn default() -> CommandQueue
fn default() -> CommandQueue
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for CommandQueue
impl RefUnwindSafe for CommandQueue
impl Send for CommandQueue
impl Sync for CommandQueue
impl Unpin for CommandQueue
impl UnsafeUnpin for CommandQueue
impl UnwindSafe for CommandQueue
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<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>
Converts
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>
Converts
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