Struct rlua::prelude::LuaUserDataRegistry
source · pub struct LuaUserDataRegistry<'lua, T>where
T: 'static,{ /* private fields */ }
Expand description
Handle to registry for userdata methods and metamethods.
Trait Implementations§
source§impl<'lua, T> UserDataFields<'lua, T> for UserDataRegistry<'lua, T>where
T: 'static,
impl<'lua, T> UserDataFields<'lua, T> for UserDataRegistry<'lua, T>where
T: 'static,
source§fn add_field<V>(&mut self, name: impl AsRef<str>, value: V)
fn add_field<V>(&mut self, name: impl AsRef<str>, value: V)
Add a static field to the
UserData
. Read moresource§fn add_field_method_get<M, R>(&mut self, name: impl AsRef<str>, method: M)
fn add_field_method_get<M, R>(&mut self, name: impl AsRef<str>, method: M)
Add a regular field getter as a method which accepts a
&T
as the parameter. Read moresource§fn add_field_method_set<M, A>(&mut self, name: impl AsRef<str>, method: M)
fn add_field_method_set<M, A>(&mut self, name: impl AsRef<str>, method: M)
Add a regular field setter as a method which accepts a
&mut T
as the first parameter. Read moresource§fn add_field_function_get<F, R>(&mut self, name: impl AsRef<str>, function: F)
fn add_field_function_get<F, R>(&mut self, name: impl AsRef<str>, function: F)
Add a regular field getter as a function which accepts a generic
AnyUserData
of type T
argument. Read moresource§fn add_field_function_set<F, A>(&mut self, name: impl AsRef<str>, function: F)
fn add_field_function_set<F, A>(&mut self, name: impl AsRef<str>, function: F)
Add a regular field setter as a function which accepts a generic
AnyUserData
of type T
first argument. Read moresource§impl<'lua, T> UserDataMethods<'lua, T> for UserDataRegistry<'lua, T>where
T: 'static,
impl<'lua, T> UserDataMethods<'lua, T> for UserDataRegistry<'lua, T>where
T: 'static,
source§fn add_method<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: Fn(&'lua Lua, &T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_method<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: Fn(&'lua Lua, &T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a regular method which accepts a
&T
as the first parameter. Read moresource§fn add_method_mut<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: FnMut(&'lua Lua, &mut T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_method_mut<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: FnMut(&'lua Lua, &mut T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a regular method which accepts a
&mut T
as the first parameter. Read moresource§fn add_function<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: Fn(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_function<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: Fn(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a regular method as a function which accepts generic arguments, the first argument will
be a
AnyUserData
of type T
if the method is called with Lua method syntax:
my_userdata:my_method(arg1, arg2)
, or it is passed in as the first argument:
my_userdata.my_method(my_userdata, arg1, arg2)
. Read moresource§fn add_function_mut<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: FnMut(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_function_mut<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: FnMut(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a regular method as a mutable function which accepts generic arguments. Read more
source§fn add_meta_method<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: Fn(&'lua Lua, &T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_meta_method<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: Fn(&'lua Lua, &T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a metamethod which accepts a
&T
as the first parameter. Read moresource§fn add_meta_method_mut<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: FnMut(&'lua Lua, &mut T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_meta_method_mut<M, A, R>(&mut self, name: impl AsRef<str>, method: M)where
M: FnMut(&'lua Lua, &mut T, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a metamethod as a function which accepts a
&mut T
as the first parameter. Read moresource§fn add_meta_function<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: Fn(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_meta_function<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: Fn(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a metamethod which accepts generic arguments. Read more
source§fn add_meta_function_mut<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: FnMut(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
fn add_meta_function_mut<F, A, R>(&mut self, name: impl AsRef<str>, function: F)where
F: FnMut(&'lua Lua, A) -> Result<R, Error> + MaybeSend + 'static,
A: FromLuaMulti<'lua>,
R: IntoLuaMulti<'lua>,
Add a metamethod as a mutable function which accepts generic arguments. Read more
Auto Trait Implementations§
impl<'lua, T> !RefUnwindSafe for UserDataRegistry<'lua, T>
impl<'lua, T> !Send for UserDataRegistry<'lua, T>
impl<'lua, T> !Sync for UserDataRegistry<'lua, T>
impl<'lua, T> Unpin for UserDataRegistry<'lua, T>where
T: Unpin,
impl<'lua, T> !UnwindSafe for UserDataRegistry<'lua, T>
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