Skip to main content

TypedDataMethods

Trait TypedDataMethods 

Source
pub trait TypedDataMethods<T> {
Show 18 methods // Required methods fn add_method<S, A, R, M>(&mut self, name: S, method: M) where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, M: 'static + MaybeSend + Fn(&Lua, &T, A) -> Result<R>; fn add_method_mut<S, A, R, M>(&mut self, name: S, method: M) where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, M: 'static + MaybeSend + FnMut(&Lua, &mut T, A) -> Result<R>; fn add_async_method<S: Into<String>, A, R, M, MR>( &mut self, name: S, method: M, ) where T: 'static, M: Fn(Lua, UserDataRef<T>, A) -> MR + MaybeSend + 'static, A: FromLuaMulti + TypedMultiValue, MR: Future<Output = Result<R>> + MaybeSend + 'static, R: IntoLuaMulti + TypedMultiValue; fn add_async_method_mut<S: Into<String>, A, R, M, MR>( &mut self, name: S, method: M, ) where T: 'static, M: Fn(Lua, UserDataRefMut<T>, A) -> MR + MaybeSend + 'static, A: FromLuaMulti + TypedMultiValue, MR: Future<Output = Result<R>> + MaybeSend + 'static, R: IntoLuaMulti + TypedMultiValue; fn add_function<S, A, R, F>(&mut self, name: S, function: F) where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + Fn(&Lua, A) -> Result<R>; fn add_function_mut<S, A, R, F>(&mut self, name: S, function: F) where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + FnMut(&Lua, A) -> Result<R>; fn add_async_function<S, A, R, F, FR>(&mut self, name: S, function: F) where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + Fn(Lua, A) -> FR, FR: 'static + MaybeSend + Future<Output = Result<R>>; fn add_meta_method<A, R, M>(&mut self, meta: impl Into<String>, method: M) where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, M: 'static + MaybeSend + Fn(&Lua, &T, A) -> Result<R>; fn add_meta_method_mut<A, R, M>( &mut self, meta: impl Into<String>, method: M, ) where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, M: 'static + MaybeSend + FnMut(&Lua, &mut T, A) -> Result<R>; fn add_meta_function<A, R, F>( &mut self, meta: impl Into<String>, function: F, ) where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + Fn(&Lua, A) -> Result<R>; fn add_meta_function_mut<A, R, F>( &mut self, meta: impl Into<String>, function: F, ) where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + FnMut(&Lua, A) -> Result<R>; fn document(&mut self, doc: impl IntoDocComment) -> &mut Self; fn param( &mut self, name: impl Display, doc: impl IntoDocComment, ) -> &mut Self; fn param_as( &mut self, ty: impl Into<Type>, name: impl Display, doc: impl IntoDocComment, ) -> &mut Self; fn ret(&mut self, doc: impl IntoDocComment) -> &mut Self; fn ret_as( &mut self, ty: impl Into<Type>, doc: impl IntoDocComment, ) -> &mut Self; fn index<I: Typed>( &mut self, idx: isize, doc: impl IntoDocComment, ) -> &mut Self; fn index_as( &mut self, idx: isize, ty: impl Into<Type>, doc: impl IntoDocComment, ) -> &mut Self;
}
Expand description

Typed variant of mlua::UserDataMethods

Required Methods§

Source

fn add_method<S, A, R, M>(&mut self, name: S, method: M)
where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, M: 'static + MaybeSend + Fn(&Lua, &T, A) -> Result<R>,

Exposes a method to lua

Source

fn add_method_mut<S, A, R, M>(&mut self, name: S, method: M)

Exposes a method to lua that has a mutable reference to Self

Source

fn add_async_method<S: Into<String>, A, R, M, MR>(&mut self, name: S, method: M)
where T: 'static, M: Fn(Lua, UserDataRef<T>, A) -> MR + MaybeSend + 'static, A: FromLuaMulti + TypedMultiValue, MR: Future<Output = Result<R>> + MaybeSend + 'static, R: IntoLuaMulti + TypedMultiValue,

exposes an async method to lua

Source

fn add_async_method_mut<S: Into<String>, A, R, M, MR>( &mut self, name: S, method: M, )
where T: 'static, M: Fn(Lua, UserDataRefMut<T>, A) -> MR + MaybeSend + 'static, A: FromLuaMulti + TypedMultiValue, MR: Future<Output = Result<R>> + MaybeSend + 'static, R: IntoLuaMulti + TypedMultiValue,

exposes an async method to lua

Source

fn add_function<S, A, R, F>(&mut self, name: S, function: F)
where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + Fn(&Lua, A) -> Result<R>,

Exposes a function to lua (its a method that does not take Self)

Source

fn add_function_mut<S, A, R, F>(&mut self, name: S, function: F)
where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + FnMut(&Lua, A) -> Result<R>,

Exposes a mutable function to lua

Source

fn add_async_function<S, A, R, F, FR>(&mut self, name: S, function: F)
where S: Into<String>, A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + Fn(Lua, A) -> FR, FR: 'static + MaybeSend + Future<Output = Result<R>>,

exposes an async function to lua

Source

fn add_meta_method<A, R, M>(&mut self, meta: impl Into<String>, method: M)
where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, M: 'static + MaybeSend + Fn(&Lua, &T, A) -> Result<R>,

Exposes a meta method to lua http://lua-users.org/wiki/MetatableEvents

Source

fn add_meta_method_mut<A, R, M>(&mut self, meta: impl Into<String>, method: M)

Exposes a meta and mutable method to lua http://lua-users.org/wiki/MetatableEvents

Source

fn add_meta_function<A, R, F>(&mut self, meta: impl Into<String>, function: F)
where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + Fn(&Lua, A) -> Result<R>,

Exposes a meta function to lua http://lua-users.org/wiki/MetatableEvents

Source

fn add_meta_function_mut<A, R, F>( &mut self, meta: impl Into<String>, function: F, )
where A: FromLuaMulti + TypedMultiValue, R: IntoLuaMulti + TypedMultiValue, F: 'static + MaybeSend + FnMut(&Lua, A) -> Result<R>,

Exposes a meta and mutable function to lua http://lua-users.org/wiki/MetatableEvents

Source

fn document(&mut self, doc: impl IntoDocComment) -> &mut Self

Adds documentation to the next method/function that gets added

Source

fn param(&mut self, name: impl Display, doc: impl IntoDocComment) -> &mut Self

Adds a param name and doc comment to the next method/function that gets added.

These will be applied to the params in the order they were defined.

Source

fn param_as( &mut self, ty: impl Into<Type>, name: impl Display, doc: impl IntoDocComment, ) -> &mut Self

Adds a param name and doc comment to the next method/function that gets added. Will also add an override type to the param.

These will be applied to the params in the order they were defined.

Source

fn ret(&mut self, doc: impl IntoDocComment) -> &mut Self

Adds a return doc comment to the next method/function that gets added.

These will be applied to the returns in the order they were defined.

Source

fn ret_as(&mut self, ty: impl Into<Type>, doc: impl IntoDocComment) -> &mut Self

Adds a return doc comment to the next method/function that gets added. Will also add an override type to the return.

These will be applied to the returns in the order they were defined.

Source

fn index<I: Typed>(&mut self, idx: isize, doc: impl IntoDocComment) -> &mut Self

Adds an index field with a type and doc comment to the class definition

Source

fn index_as( &mut self, idx: isize, ty: impl Into<Type>, doc: impl IntoDocComment, ) -> &mut Self

Adds an index field with a type and doc comment to the class definition

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§