Struct ModuleBuilder

Source
pub struct ModuleBuilder<'lua> { /* private fields */ }
Expand description

Builder that construct a module based on the Module trait

Trait Implementations§

Source§

impl<'lua> ModuleFields<'lua> for ModuleBuilder<'lua>

Source§

fn add_field<K, V>(&mut self, name: K, value: V) -> Result<()>
where K: IntoLua<'lua>, V: IntoLua<'lua>,

Add a field to the module’s table
Source§

fn add_meta_field<K, V>(&mut self, name: K, value: V) -> Result<()>
where K: IntoLua<'lua>, V: IntoLua<'lua>,

Add a field to the module’s metatable
Source§

fn add_module<K, V>(&mut self, name: K) -> Result<()>
where K: IntoLua<'lua>, V: Module,

Add a nested module as a table in this module
Source§

impl<'lua> ModuleMethods<'lua> for ModuleBuilder<'lua>

Source§

fn add_function<K, F, A, R>(&mut self, name: K, function: F) -> Result<()>
where K: IntoLua<'lua>, F: Fn(&Lua, A) -> Result<R> + MaybeSend + 'static, A: FromLuaMulti<'lua>, R: IntoLuaMulti<'lua>,

Add a function to this module’s table
Source§

fn add_meta_function<K, F, A, R>(&mut self, name: K, function: F) -> Result<()>
where K: IntoLua<'lua>, F: Fn(&Lua, A) -> Result<R> + MaybeSend + 'static, A: FromLuaMulti<'lua>, R: IntoLuaMulti<'lua>,

Add a function to this module’s metatable
Source§

fn add_method<K, F, A, R>(&mut self, name: K, function: F) -> Result<()>
where K: IntoLua<'lua>, F: Fn(&Lua, Table<'_>, A) -> Result<R> + MaybeSend + 'static, A: FromLuaMulti<'lua>, R: IntoLuaMulti<'lua>,

Add a method to this module’s table
Source§

fn add_meta_method<K, F, A, R>(&mut self, name: K, function: F) -> Result<()>
where K: IntoLua<'lua>, F: Fn(&Lua, Table<'_>, A) -> Result<R> + MaybeSend + 'static, A: FromLuaMulti<'lua>, R: IntoLuaMulti<'lua>,

Add a method to this module’s metatable

Auto Trait Implementations§

§

impl<'lua> Freeze for ModuleBuilder<'lua>

§

impl<'lua> !RefUnwindSafe for ModuleBuilder<'lua>

§

impl<'lua> !Send for ModuleBuilder<'lua>

§

impl<'lua> !Sync for ModuleBuilder<'lua>

§

impl<'lua> Unpin for ModuleBuilder<'lua>

§

impl<'lua> !UnwindSafe for ModuleBuilder<'lua>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.