pub struct LuaContext(/* private fields */);Expand description
A newtype around a lua context.
Methods from Deref<Target = Lua>§
Sourcepub unsafe fn exec_raw<R>(
&self,
args: impl IntoLuaMulti,
f: impl FnOnce(*mut lua_State),
) -> Result<R, Error>where
R: FromLuaMulti,
pub unsafe fn exec_raw<R>(
&self,
args: impl IntoLuaMulti,
f: impl FnOnce(*mut lua_State),
) -> Result<R, Error>where
R: FromLuaMulti,
Calls provided function passing a raw lua state.
The arguments will be pushed onto the stack before calling the function.
This method ensures that the Lua instance is locked while the function is called and restores Lua stack after the function returns.
§Example
let lua = Lua::new();
let n: i32 = unsafe {
let nums = (3, 4, 5);
lua.exec_raw(nums, |state| {
let n = ffi::lua_gettop(state);
let mut sum = 0;
for i in 1..=n {
sum += ffi::lua_tointeger(state, i);
}
ffi::lua_pop(state, n);
ffi::lua_pushinteger(state, sum);
})
}?;
assert_eq!(n, 12);Sourcepub fn load_std_libs(&self, libs: StdLib) -> Result<(), Error>
pub fn load_std_libs(&self, libs: StdLib) -> Result<(), Error>
Loads the specified subset of the standard libraries into an existing Lua state.
Use the StdLib flags to specify the libraries you want to load.
Sourcepub fn load_from_function<T>(
&self,
modname: &str,
func: Function,
) -> Result<T, Error>where
T: FromLua,
pub fn load_from_function<T>(
&self,
modname: &str,
func: Function,
) -> Result<T, Error>where
T: FromLua,
Loads module modname into an existing Lua state using the specified entrypoint
function.
Internally calls the Lua function func with the string modname as an argument,
sets the call result to package.loaded[modname] and returns copy of the result.
If package.loaded[modname] value is not nil, returns copy of the value without
calling the function.
If the function does not return a non-nil value then this method assigns true to
package.loaded[modname].
Behavior is similar to Lua’s require function.
Sourcepub fn unload(&self, modname: &str) -> Result<(), Error>
pub fn unload(&self, modname: &str) -> Result<(), Error>
Unloads module modname.
Removes module from the package.loaded table which allows to load it again.
It does not support unloading binary Lua modules since they are internally cached and can be
unloaded only by closing Lua state.
Sourcepub fn set_hook<F>(&self, triggers: HookTriggers, callback: F)
pub fn set_hook<F>(&self, triggers: HookTriggers, callback: F)
Sets a hook function that will periodically be called as Lua code executes.
When exactly the hook function is called depends on the contents of the triggers
parameter, see HookTriggers for more details.
The provided hook function can error, and this error will be propagated through the Lua code
that was executing at the time the hook was triggered. This can be used to implement a
limited form of execution limits by setting HookTriggers.every_nth_instruction and
erroring once an instruction limit has been reached.
This method sets a hook function for the current thread of this Lua instance.
If you want to set a hook function for another thread (coroutine), use
Thread::set_hook instead.
Please note you cannot have more than one hook function set at a time for this Lua instance.
§Example
Shows each line number of code being executed by the Lua interpreter.
let lua = Lua::new();
lua.set_hook(HookTriggers::EVERY_LINE, |_lua, debug| {
println!("line {}", debug.curr_line());
Ok(VmState::Continue)
});
lua.load(r#"
local x = 2 + 3
local y = x * 63
local z = string.len(x..", "..y)
"#).exec()Sourcepub fn remove_hook(&self)
pub fn remove_hook(&self)
Removes any hook previously set by Lua::set_hook or Thread::set_hook.
This function has no effect if a hook was not previously set.
Sourcepub fn set_warning_function<F>(&self, callback: F)
pub fn set_warning_function<F>(&self, callback: F)
Sets the warning function to be used by Lua to emit warnings.
Requires feature = "lua54"
Sourcepub fn remove_warning_function(&self)
pub fn remove_warning_function(&self)
Removes warning function previously set by set_warning_function.
This function has no effect if a warning function was not previously set.
Requires feature = "lua54"
Sourcepub fn warning(&self, msg: impl AsRef<str>, incomplete: bool)
pub fn warning(&self, msg: impl AsRef<str>, incomplete: bool)
Emits a warning with the given message.
A message in a call with incomplete set to true should be continued in
another call to this function.
Requires feature = "lua54"
Sourcepub fn inspect_stack(&self, level: usize) -> Option<Debug<'_>>
pub fn inspect_stack(&self, level: usize) -> Option<Debug<'_>>
Gets information about the interpreter runtime stack.
This function returns Debug structure that can be used to get information about the
function executing at a given level. Level 0 is the current running function, whereas
level n+1 is the function that has called level n (except for tail calls, which do
not count in the stack).
Sourcepub fn used_memory(&self) -> usize
pub fn used_memory(&self) -> usize
Returns the amount of memory (in bytes) currently used inside this Lua state.
Sourcepub fn set_memory_limit(&self, limit: usize) -> Result<usize, Error>
pub fn set_memory_limit(&self, limit: usize) -> Result<usize, Error>
Sets a memory limit (in bytes) on this Lua state.
Once an allocation occurs that would pass this memory limit, a Error::MemoryError is
generated instead.
Returns previous limit (zero means no limit).
Does not work in module mode where Lua state is managed externally.
Sourcepub fn gc_is_running(&self) -> bool
pub fn gc_is_running(&self) -> bool
Returns true if the garbage collector is currently running automatically.
Requires feature = "lua54/lua53/lua52/luau"
Sourcepub fn gc_restart(&self)
pub fn gc_restart(&self)
Restarts the Lua GC if it is not running
Sourcepub fn gc_collect(&self) -> Result<(), Error>
pub fn gc_collect(&self) -> Result<(), Error>
Perform a full garbage-collection cycle.
It may be necessary to call this function twice to collect all currently unreachable objects. Once to finish the current gc cycle, and once to start and finish the next cycle.
Sourcepub fn gc_step(&self) -> Result<bool, Error>
pub fn gc_step(&self) -> Result<bool, Error>
Steps the garbage collector one indivisible step.
Returns true if this has finished a collection cycle.
Sourcepub fn gc_step_kbytes(&self, kbytes: i32) -> Result<bool, Error>
pub fn gc_step_kbytes(&self, kbytes: i32) -> Result<bool, Error>
Steps the garbage collector as though memory had been allocated.
if kbytes is 0, then this is the same as calling gc_step. Returns true if this step has
finished a collection cycle.
Sourcepub fn gc_set_pause(&self, pause: i32) -> i32
pub fn gc_set_pause(&self, pause: i32) -> i32
Sets the pause value of the collector.
Returns the previous value of pause. More information can be found in the Lua
documentation.
For Luau this parameter sets GC goal
Sourcepub fn gc_set_step_multiplier(&self, step_multiplier: i32) -> i32
pub fn gc_set_step_multiplier(&self, step_multiplier: i32) -> i32
Sets the step multiplier value of the collector.
Returns the previous value of the step multiplier. More information can be found in the
Lua documentation.
Sourcepub fn gc_inc(&self, pause: i32, step_multiplier: i32, step_size: i32) -> GCMode
pub fn gc_inc(&self, pause: i32, step_multiplier: i32, step_size: i32) -> GCMode
Changes the collector to incremental mode with the given parameters.
Returns the previous mode (always GCMode::Incremental in Lua < 5.4).
More information can be found in the Lua documentation.
Sourcepub fn gc_gen(&self, minor_multiplier: i32, major_multiplier: i32) -> GCMode
pub fn gc_gen(&self, minor_multiplier: i32, major_multiplier: i32) -> GCMode
Changes the collector to generational mode with the given parameters.
Returns the previous mode. More information about the generational GC can be found in the Lua 5.4 documentation.
Requires feature = "lua54"
Sourcepub fn load<'a>(&self, chunk: impl AsChunk<'a>) -> Chunk<'a>
pub fn load<'a>(&self, chunk: impl AsChunk<'a>) -> Chunk<'a>
Returns Lua source code as a Chunk builder type.
In order to actually compile or run the resulting code, you must call Chunk::exec or
similar on the returned builder. Code is not even parsed until one of these methods is
called.
Sourcepub fn create_string(&self, s: impl AsRef<[u8]>) -> Result<String, Error>
pub fn create_string(&self, s: impl AsRef<[u8]>) -> Result<String, Error>
Create and return an interned Lua string.
Lua strings can be arbitrary [u8] data including embedded nulls, so in addition to &str
and &String, you can also pass plain &[u8] here.
Sourcepub fn create_table(&self) -> Result<Table, Error>
pub fn create_table(&self) -> Result<Table, Error>
Creates and returns a new empty table.
Sourcepub fn create_table_with_capacity(
&self,
narr: usize,
nrec: usize,
) -> Result<Table, Error>
pub fn create_table_with_capacity( &self, narr: usize, nrec: usize, ) -> Result<Table, Error>
Creates and returns a new empty table, with the specified capacity.
narris a hint for how many elements the table will have as a sequence.nrecis a hint for how many other elements the table will have.
Lua may use these hints to preallocate memory for the new table.
Sourcepub fn create_table_from<K, V>(
&self,
iter: impl IntoIterator<Item = (K, V)>,
) -> Result<Table, Error>
pub fn create_table_from<K, V>( &self, iter: impl IntoIterator<Item = (K, V)>, ) -> Result<Table, Error>
Creates a table and fills it with values from an iterator.
Sourcepub fn create_sequence_from<T>(
&self,
iter: impl IntoIterator<Item = T>,
) -> Result<Table, Error>where
T: IntoLua,
pub fn create_sequence_from<T>(
&self,
iter: impl IntoIterator<Item = T>,
) -> Result<Table, Error>where
T: IntoLua,
Creates a table from an iterator of values, using 1.. as the keys.
Sourcepub fn create_function<F, A, R>(&self, func: F) -> Result<Function, Error>
pub fn create_function<F, A, R>(&self, func: F) -> Result<Function, Error>
Wraps a Rust function or closure, creating a callable Lua function handle to it.
The function’s return value is always a Result: If the function returns Err, the error
is raised as a Lua error, which can be caught using (x)pcall or bubble up to the Rust code
that invoked the Lua code. This allows using the ? operator to propagate errors through
intermediate Lua code.
If the function returns Ok, the contained value will be converted to one or more Lua
values. For details on Rust-to-Lua conversions, refer to the IntoLua and
IntoLuaMulti traits.
§Examples
Create a function which prints its argument:
let greet = lua.create_function(|_, name: String| {
println!("Hello, {}!", name);
Ok(())
});Use tuples to accept multiple arguments:
let print_person = lua.create_function(|_, (name, age): (String, u8)| {
println!("{} is {} years old!", name, age);
Ok(())
});Sourcepub fn create_function_mut<F, A, R>(&self, func: F) -> Result<Function, Error>where
F: FnMut(&Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti,
R: IntoLuaMulti,
pub fn create_function_mut<F, A, R>(&self, func: F) -> Result<Function, Error>where
F: FnMut(&Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti,
R: IntoLuaMulti,
Wraps a Rust mutable closure, creating a callable Lua function handle to it.
This is a version of Lua::create_function that accepts a FnMut argument.
Sourcepub unsafe fn create_c_function(
&self,
func: unsafe extern "C-unwind" fn(*mut lua_State) -> i32,
) -> Result<Function, Error>
pub unsafe fn create_c_function( &self, func: unsafe extern "C-unwind" fn(*mut lua_State) -> i32, ) -> Result<Function, Error>
Wraps a C function, creating a callable Lua function handle to it.
§Safety
This function is unsafe because provides a way to execute unsafe C function.
Sourcepub fn create_thread(&self, func: Function) -> Result<Thread, Error>
pub fn create_thread(&self, func: Function) -> Result<Thread, Error>
Wraps a Lua function into a new thread (or coroutine).
Equivalent to coroutine.create.
Sourcepub fn create_userdata<T>(&self, data: T) -> Result<AnyUserData, Error>
pub fn create_userdata<T>(&self, data: T) -> Result<AnyUserData, Error>
Creates a Lua userdata object from a custom userdata type.
All userdata instances of the same type T shares the same metatable.
Sourcepub fn create_any_userdata<T>(&self, data: T) -> Result<AnyUserData, Error>where
T: MaybeSend + 'static,
pub fn create_any_userdata<T>(&self, data: T) -> Result<AnyUserData, Error>where
T: MaybeSend + 'static,
Creates a Lua userdata object from a custom Rust type.
You can register the type using Lua::register_userdata_type to add fields or methods
before calling this method.
Otherwise, the userdata object will have an empty metatable.
All userdata instances of the same type T shares the same metatable.
Sourcepub fn register_userdata_type<T>(
&self,
f: impl FnOnce(&mut UserDataRegistry<T>),
) -> Result<(), Error>where
T: 'static,
pub fn register_userdata_type<T>(
&self,
f: impl FnOnce(&mut UserDataRegistry<T>),
) -> Result<(), Error>where
T: 'static,
Registers a custom Rust type in Lua to use in userdata objects.
This methods provides a way to add fields or methods to userdata objects of a type T.
Sourcepub fn create_proxy<T>(&self) -> Result<AnyUserData, Error>where
T: UserData + 'static,
pub fn create_proxy<T>(&self) -> Result<AnyUserData, Error>where
T: UserData + 'static,
Create a Lua userdata “proxy” object from a custom userdata type.
Proxy object is an empty userdata object that has T metatable attached.
The main purpose of this object is to provide access to static fields and functions
without creating an instance of type T.
You can get or set uservalues on this object but you cannot borrow any Rust type.
§Examples
struct MyUserData(i32);
impl UserData for MyUserData {
fn add_fields<F: UserDataFields<Self>>(fields: &mut F) {
fields.add_field_method_get("val", |_, this| Ok(this.0));
}
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M) {
methods.add_function("new", |_, value: i32| Ok(MyUserData(value)));
}
}
lua.globals().set("MyUserData", lua.create_proxy::<MyUserData>()?)?;
lua.load("assert(MyUserData.new(321).val == 321)").exec()?;Sourcepub fn set_type_metatable<T>(&self, metatable: Option<Table>)where
T: LuaType,
pub fn set_type_metatable<T>(&self, metatable: Option<Table>)where
T: LuaType,
Sets the metatable for a Lua builtin type.
The metatable will be shared by all values of the given type.
§Examples
Change metatable for Lua boolean type:
let mt = lua.create_table()?;
mt.set("__tostring", lua.create_function(|_, b: bool| Ok(if b { "2" } else { "0" }))?)?;
lua.set_type_metatable::<bool>(Some(mt));
lua.load("assert(tostring(true) == '2')").exec()?;Sourcepub fn current_thread(&self) -> Thread
pub fn current_thread(&self) -> Thread
Returns a handle to the active Thread.
For calls to Lua this will be the main Lua thread, for parameters given to a callback,
this will be whatever Lua thread called the callback.
Sourcepub fn scope<'env, R>(
&self,
f: impl for<'scope> FnOnce(&'scope mut Scope<'scope, 'env>) -> Result<R, Error>,
) -> Result<R, Error>
pub fn scope<'env, R>( &self, f: impl for<'scope> FnOnce(&'scope mut Scope<'scope, 'env>) -> Result<R, Error>, ) -> Result<R, Error>
Calls the given function with a Scope parameter, giving the function the ability to
create userdata and callbacks from Rust types that are !Send or non-'static.
The lifetime of any function or userdata created through Scope lasts only until the
completion of this method call, on completion all such created values are automatically
dropped and Lua references to them are invalidated. If a script accesses a value created
through Scope outside of this method, a Lua error will result. Since we can ensure the
lifetime of values created through Scope, and we know that Lua cannot be sent to
another thread while Scope is live, it is safe to allow !Send data types and whose
lifetimes only outlive the scope lifetime.
Sourcepub fn coerce_string(&self, v: Value) -> Result<Option<String>, Error>
pub fn coerce_string(&self, v: Value) -> Result<Option<String>, Error>
Attempts to coerce a Lua value into a String in a manner consistent with Lua’s internal behavior.
To succeed, the value must be a string (in which case this is a no-op), an integer, or a number.
Sourcepub fn coerce_integer(&self, v: Value) -> Result<Option<i64>, Error>
pub fn coerce_integer(&self, v: Value) -> Result<Option<i64>, Error>
Attempts to coerce a Lua value into an integer in a manner consistent with Lua’s internal behavior.
To succeed, the value must be an integer, a floating point number that has an exact representation as an integer, or a string that can be converted to an integer. Refer to the Lua manual for details.
Sourcepub fn coerce_number(&self, v: Value) -> Result<Option<f64>, Error>
pub fn coerce_number(&self, v: Value) -> Result<Option<f64>, Error>
Attempts to coerce a Lua value into a Number in a manner consistent with Lua’s internal behavior.
To succeed, the value must be a number or a string that can be converted to a number. Refer to the Lua manual for details.
Sourcepub fn pack_multi(&self, t: impl IntoLuaMulti) -> Result<MultiValue, Error>
pub fn pack_multi(&self, t: impl IntoLuaMulti) -> Result<MultiValue, Error>
Converts a value that implements IntoLuaMulti into a MultiValue instance.
Sourcepub fn unpack_multi<T>(&self, value: MultiValue) -> Result<T, Error>where
T: FromLuaMulti,
pub fn unpack_multi<T>(&self, value: MultiValue) -> Result<T, Error>where
T: FromLuaMulti,
Converts a MultiValue instance into a value that implements FromLuaMulti.
Sourcepub fn set_named_registry_value(
&self,
key: &str,
t: impl IntoLua,
) -> Result<(), Error>
pub fn set_named_registry_value( &self, key: &str, t: impl IntoLua, ) -> Result<(), Error>
Set a value in the Lua registry based on a string key.
This value will be available to Rust from all Lua instances which share the same main state.
Sourcepub fn named_registry_value<T>(&self, key: &str) -> Result<T, Error>where
T: FromLua,
pub fn named_registry_value<T>(&self, key: &str) -> Result<T, Error>where
T: FromLua,
Get a value from the Lua registry based on a string key.
Any Lua instance which shares the underlying main state may call this method to
get a value previously set by Lua::set_named_registry_value.
Sourcepub fn unset_named_registry_value(&self, key: &str) -> Result<(), Error>
pub fn unset_named_registry_value(&self, key: &str) -> Result<(), Error>
Removes a named value in the Lua registry.
Equivalent to calling Lua::set_named_registry_value with a value of Nil.
Sourcepub fn create_registry_value(
&self,
t: impl IntoLua,
) -> Result<RegistryKey, Error>
pub fn create_registry_value( &self, t: impl IntoLua, ) -> Result<RegistryKey, Error>
Place a value in the Lua registry with an auto-generated key.
This value will be available to Rust from all Lua instances which share the same main state.
Be warned, garbage collection of values held inside the registry is not automatic, see
RegistryKey for more details.
However, dropped RegistryKeys automatically reused to store new values.
Sourcepub fn registry_value<T>(&self, key: &RegistryKey) -> Result<T, Error>where
T: FromLua,
pub fn registry_value<T>(&self, key: &RegistryKey) -> Result<T, Error>where
T: FromLua,
Get a value from the Lua registry by its RegistryKey
Any Lua instance which shares the underlying main state may call this method to get a value
previously placed by Lua::create_registry_value.
Sourcepub fn remove_registry_value(&self, key: RegistryKey) -> Result<(), Error>
pub fn remove_registry_value(&self, key: RegistryKey) -> Result<(), Error>
Removes a value from the Lua registry.
You may call this function to manually remove a value placed in the registry with
Lua::create_registry_value. In addition to manual RegistryKey removal, you can also
call Lua::expire_registry_values to automatically remove values from the registry
whose RegistryKeys have been dropped.
Sourcepub fn replace_registry_value(
&self,
key: &mut RegistryKey,
t: impl IntoLua,
) -> Result<(), Error>
pub fn replace_registry_value( &self, key: &mut RegistryKey, t: impl IntoLua, ) -> Result<(), Error>
Replaces a value in the Lua registry by its RegistryKey.
An identifier used in RegistryKey may possibly be changed to a new value.
See Lua::create_registry_value for more details.
Sourcepub fn owns_registry_value(&self, key: &RegistryKey) -> bool
pub fn owns_registry_value(&self, key: &RegistryKey) -> bool
Returns true if the given RegistryKey was created by a Lua which shares the
underlying main state with this Lua instance.
Other than this, methods that accept a RegistryKey will return
Error::MismatchedRegistryKey if passed a RegistryKey that was not created with a
matching Lua state.
Sourcepub fn expire_registry_values(&self)
pub fn expire_registry_values(&self)
Remove any registry values whose RegistryKeys have all been dropped.
Unlike normal handle values, RegistryKeys do not automatically remove themselves on
Drop, but you can call this method to remove any unreachable registry values not
manually removed by Lua::remove_registry_value.
Sourcepub fn set_app_data<T>(&self, data: T) -> Option<T>where
T: MaybeSend + 'static,
pub fn set_app_data<T>(&self, data: T) -> Option<T>where
T: MaybeSend + 'static,
Sets or replaces an application data object of type T.
Application data could be accessed at any time by using Lua::app_data_ref or
Lua::app_data_mut methods where T is the data type.
§Panics
Panics if the app data container is currently borrowed.
§Examples
use mlua::{Lua, Result};
fn hello(lua: &Lua, _: ()) -> Result<()> {
let mut s = lua.app_data_mut::<&str>().unwrap();
assert_eq!(*s, "hello");
*s = "world";
Ok(())
}
fn main() -> Result<()> {
let lua = Lua::new();
lua.set_app_data("hello");
lua.create_function(hello)?.call::<()>(())?;
let s = lua.app_data_ref::<&str>().unwrap();
assert_eq!(*s, "world");
Ok(())
}Sourcepub fn try_set_app_data<T>(&self, data: T) -> Result<Option<T>, T>where
T: MaybeSend + 'static,
pub fn try_set_app_data<T>(&self, data: T) -> Result<Option<T>, T>where
T: MaybeSend + 'static,
Tries to set or replace an application data object of type T.
Returns:
Ok(Some(old_data))if the data object of typeTwas successfully replaced.Ok(None)if the data object of typeTwas successfully inserted.Err(data)if the data object of typeTwas not inserted because the container is currently borrowed.
See Lua::set_app_data for examples.
Sourcepub fn app_data_ref<T>(&self) -> Option<AppDataRef<'_, T>>where
T: 'static,
pub fn app_data_ref<T>(&self) -> Option<AppDataRef<'_, T>>where
T: 'static,
Gets a reference to an application data object stored by Lua::set_app_data of type
T.
§Panics
Panics if the data object of type T is currently mutably borrowed. Multiple immutable
reads can be taken out at the same time.
Sourcepub fn try_app_data_ref<T>(
&self,
) -> Result<Option<AppDataRef<'_, T>>, BorrowError>where
T: 'static,
pub fn try_app_data_ref<T>(
&self,
) -> Result<Option<AppDataRef<'_, T>>, BorrowError>where
T: 'static,
Tries to get a reference to an application data object stored by Lua::set_app_data of
type T.
Sourcepub fn app_data_mut<T>(&self) -> Option<AppDataRefMut<'_, T>>where
T: 'static,
pub fn app_data_mut<T>(&self) -> Option<AppDataRefMut<'_, T>>where
T: 'static,
Gets a mutable reference to an application data object stored by Lua::set_app_data of
type T.
§Panics
Panics if the data object of type T is currently borrowed.
Sourcepub fn try_app_data_mut<T>(
&self,
) -> Result<Option<AppDataRefMut<'_, T>>, BorrowMutError>where
T: 'static,
pub fn try_app_data_mut<T>(
&self,
) -> Result<Option<AppDataRefMut<'_, T>>, BorrowMutError>where
T: 'static,
Tries to get a mutable reference to an application data object stored by
Lua::set_app_data of type T.
Sourcepub fn remove_app_data<T>(&self) -> Option<T>where
T: 'static,
pub fn remove_app_data<T>(&self) -> Option<T>where
T: 'static,
Removes an application data of type T.
§Panics
Panics if the app data container is currently borrowed.
Trait Implementations§
Source§impl Clone for LuaContext
impl Clone for LuaContext
Source§fn clone(&self) -> LuaContext
fn clone(&self) -> LuaContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LuaContext
impl Debug for LuaContext
Source§impl Deref for LuaContext
impl Deref for LuaContext
Auto Trait Implementations§
impl Freeze for LuaContext
impl !RefUnwindSafe for LuaContext
impl Send for LuaContext
impl Sync for LuaContext
impl Unpin for LuaContext
impl !UnwindSafe for LuaContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>, which can then be
downcast into Box<dyn 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>, which 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<T> DowncastSend for T
impl<T> DowncastSend for 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 moreSource§impl<T> IntoNamespace for Twhere
T: 'static + ?Sized,
impl<T> IntoNamespace for Twhere
T: 'static + ?Sized,
Source§fn into_namespace() -> Namespace
fn into_namespace() -> Namespace
Namespace