pub struct LuaVm { /* private fields */ }Methods from Deref<Target = Lua>§
Sourcepub fn load_core(&mut self)
pub fn load_core(&mut self)
Load the core parts of the stdlib that do not allow performing any I/O.
Calls:
load_baseload_coroutineload_mathload_stringload_table
Sourcepub fn total_memory(&self) -> usize
pub fn total_memory(&self) -> usize
Size of all memory used by this Lua context.
This is equivalent to self.gc_metrics().total_allocation(). This counts all Gc allocated
memory and also all data Lua datastructures held inside Gc, as they are tracked as
“external allocations” in gc-arena.
Sourcepub fn gc_collect(&mut self)
pub fn gc_collect(&mut self)
Finish the current collection cycle completely, calls gc_arena::Arena::collect_all().
pub fn gc_metrics(&self) -> &Metrics
Sourcepub fn enter<F, T>(&mut self, f: F) -> T
pub fn enter<F, T>(&mut self, f: F) -> T
Enter the garbage collection arena and perform some operation.
In order to interact with Lua or do any useful work with Lua values, you must do so from
within the garbage collection arena. All values branded with the 'gc branding lifetime
must forever live inside the arena, and cannot escape it.
Garbage collection takes place in-between calls to Lua::enter, no garbage will be
collected cocurrently with accessing the arena.
Automatically triggers garbage collection before returning if the allocation debt is larger than a small constant.
Sourcepub fn try_enter<F, R>(&mut self, f: F) -> Result<R, StaticError>
pub fn try_enter<F, R>(&mut self, f: F) -> Result<R, StaticError>
A version of Lua::enter that expects failure and also automatically converts Error types
into StaticError, allowing the error type to escape the arena.
Sourcepub fn finish(&mut self, executor: &StashedExecutor)
pub fn finish(&mut self, executor: &StashedExecutor)
Run the given executor to completion.
This will periodically exit the arena in order to collect garbage concurrently with running Lua code.
Sourcepub fn execute<R>(
&mut self,
executor: &StashedExecutor,
) -> Result<R, StaticError>where
R: for<'gc> FromMultiValue<'gc>,
pub fn execute<R>(
&mut self,
executor: &StashedExecutor,
) -> Result<R, StaticError>where
R: for<'gc> FromMultiValue<'gc>,
Run the given executor to completion and then take return values from the returning thread.
This is equivalent to calling Lua::finish on an executor and then calling
Executor::take_result yourself.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LuaVm
impl !RefUnwindSafe for LuaVm
impl !Send for LuaVm
impl !Sync for LuaVm
impl Unpin for LuaVm
impl !UnwindSafe for LuaVm
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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