Struct sandkiste_lua::v5_3::LuaModule
source · [−]pub struct LuaModule<'a, 'b> { /* private fields */ }
Expand description
(Sub-)module in a LuaMachine
(which is a Lua table)
The type LuaModule
is used to implement the abstract Module
trait
which allows getting and setting variables (through Module::get
and
Module::set
, respectively) a module (in this case: in a Lua table).
A LuaModule
may be obtained by calling HasModules::module
on the
LuaMachine
(to obtain a top-level module/table) or Module::module
on a LuaModule
(to obtain a sub module/table, respectively).
To set global variables, use Globals::get
and Globals::set
directly
on the LuaMachine
instead.
Lifetimes
Lifetime argument 'a
corresponds to the lifetime argument 'a
of
LuaMachine
. It is a lower bound for closures passed to the Lua machine.
Lifetime argument 'b
corresponds to the lifetime of the shared reference
to the LuaMachine
being worked with.
Trait Implementations
sourceimpl<'a, 'b> Module<'a, 'b> for LuaModule<'a, 'b>
impl<'a, 'b> Module<'a, 'b> for LuaModule<'a, 'b>
sourcefn module(&self, name: &str) -> Result<Self, MachineError>
fn module(&self, name: &str) -> Result<Self, MachineError>
Open a sub-module (create if non-existent)
sourcefn get(
&self,
name: &str
) -> Result<<Self::Machine as Machine<'a>>::Datum<'b, 'static>, MachineError>
fn get(
&self,
name: &str
) -> Result<<Self::Machine as Machine<'a>>::Datum<'b, 'static>, MachineError>
Get value from module
sourcefn set<'c>(
&self,
name: &str,
datum: <Self::Machine as Machine<'a>>::Datum<'b, 'c>
) -> Result<(), MachineError>
fn set<'c>(
&self,
name: &str,
datum: <Self::Machine as Machine<'a>>::Datum<'b, 'c>
) -> Result<(), MachineError>
Set value in module
type Machine = LuaMachine<'a>
type Machine = LuaMachine<'a>
Machine type which the module belongs to
Auto Trait Implementations
impl<'a, 'b> RefUnwindSafe for LuaModule<'a, 'b>
impl<'a, 'b> !Send for LuaModule<'a, 'b>
impl<'a, 'b> !Sync for LuaModule<'a, 'b>
impl<'a, 'b> Unpin for LuaModule<'a, 'b> where
'a: 'b,
impl<'a, 'b> UnwindSafe for LuaModule<'a, 'b>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more