pub trait UserDataMethods<T: UserData> {
// Required methods
fn add_method<A, R, F>(&mut self, name: &str, method: F)
where A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &T, A) -> Result<R> + 'static;
fn add_method_mut<A, R, F>(&mut self, name: &str, method: F)
where A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &mut T, A) -> Result<R> + 'static;
fn add_meta_method<A, R, F>(&mut self, metamethod: MetaMethod, method: F)
where A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &T, A) -> Result<R> + 'static;
fn add_meta_method_mut<A, R, F>(
&mut self,
metamethod: MetaMethod,
method: F,
)
where A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &mut T, A) -> Result<R> + 'static;
fn add_field_method_get<R, F>(&mut self, name: &str, getter: F)
where R: IntoLuaMulti + 'static,
F: Fn(&Lua, &T) -> Result<R> + 'static;
fn add_field_method_set<A, F>(&mut self, name: &str, setter: F)
where A: FromLuaMulti + 'static,
F: Fn(&Lua, &mut T, A) -> Result<()> + 'static;
}Required Methods§
fn add_method<A, R, F>(&mut self, name: &str, method: F)where
A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &T, A) -> Result<R> + 'static,
fn add_method_mut<A, R, F>(&mut self, name: &str, method: F)where
A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &mut T, A) -> Result<R> + 'static,
fn add_meta_method<A, R, F>(&mut self, metamethod: MetaMethod, method: F)where
A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &T, A) -> Result<R> + 'static,
fn add_meta_method_mut<A, R, F>(&mut self, metamethod: MetaMethod, method: F)where
A: FromLuaMulti + 'static,
R: IntoLuaMulti + 'static,
F: Fn(&Lua, &mut T, A) -> Result<R> + 'static,
Sourcefn add_field_method_get<R, F>(&mut self, name: &str, getter: F)
fn add_field_method_get<R, F>(&mut self, name: &str, getter: F)
Register a getter for obj.name. The runtime composes all field getters,
the method table, and any raw __index into a single __index so fields
and methods coexist (lookup order: field, then method, then raw __index).
Sourcefn add_field_method_set<A, F>(&mut self, name: &str, setter: F)
fn add_field_method_set<A, F>(&mut self, name: &str, setter: F)
Register a setter for obj.name = value. Assigning a field with no setter
(or an unknown field) errors unless a raw __newindex handles it.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".