pub struct WrappedBuilder<'ctx, U>(/* private fields */);Expand description
Wrapper around a UserDataFields and UserDataMethods
to allow TypedUserData implementations to be used for mlua::UserData
implementations
Implementations§
Source§impl<'ctx, U> WrappedBuilder<'ctx, U>
impl<'ctx, U> WrappedBuilder<'ctx, U>
pub fn new(u: &'ctx mut U) -> Self
Trait Implementations§
Source§impl<'ctx, T: UserData, U: UserDataFields<T>> TypedDataFields<T> for WrappedBuilder<'ctx, U>
impl<'ctx, T: UserData, U: UserDataFields<T>> TypedDataFields<T> for WrappedBuilder<'ctx, U>
Source§fn document(&mut self, _doc: impl IntoDocComment) -> &mut Self
fn document(&mut self, _doc: impl IntoDocComment) -> &mut Self
Adds documentation to the next field that gets added
Source§fn coerce(&mut self, _ty: impl Into<Type>) -> &mut Self
fn coerce(&mut self, _ty: impl Into<Type>) -> &mut Self
Adds a type to the queued overrides. Read more
Source§fn add_field_function_set<S, A, F>(&mut self, name: S, function: F)
fn add_field_function_set<S, A, F>(&mut self, name: S, function: F)
Typed version of add_field_function_set
Source§fn add_field_function_get<S, R, F>(&mut self, name: S, function: F)
fn add_field_function_get<S, R, F>(&mut self, name: S, function: F)
Typed version of add_field_function_get
Source§fn add_field_function_get_set<S, R, A, GET, SET>(
&mut self,
name: S,
get: GET,
set: SET,
)
fn add_field_function_get_set<S, R, A, GET, SET>( &mut self, name: S, get: GET, set: SET, )
Typed version of add_field_function_get and add_field_function_set combined
Source§fn add_field_method_set<S, A, M>(&mut self, name: S, method: M)
fn add_field_method_set<S, A, M>(&mut self, name: S, method: M)
Typed version of dd_field_method_set
Source§fn add_field_method_get<S, R, M>(&mut self, name: S, method: M)
fn add_field_method_get<S, R, M>(&mut self, name: S, method: M)
Typed version of add_field_method_get
Source§fn add_field_method_get_set<S, R, A, GET, SET>(
&mut self,
name: S,
get: GET,
set: SET,
)
fn add_field_method_get_set<S, R, A, GET, SET>( &mut self, name: S, get: GET, set: SET, )
Typed version of add_field_method_get and add_field_method_set combined
Source§fn add_meta_field<V>(&mut self, meta: impl Into<String>, value: V)where
V: IntoLua + 'static,
fn add_meta_field<V>(&mut self, meta: impl Into<String>, value: V)where
V: IntoLua + 'static,
Typed version of add_meta_field
Source§impl<'ctx, T: UserData, U: UserDataMethods<T>> TypedDataMethods<T> for WrappedBuilder<'ctx, U>
impl<'ctx, T: UserData, U: UserDataMethods<T>> TypedDataMethods<T> for WrappedBuilder<'ctx, U>
Source§fn document(&mut self, _documentation: impl IntoDocComment) -> &mut Self
fn document(&mut self, _documentation: 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
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. Read more
Source§fn param_as(
&mut self,
_ty: impl Into<Type>,
_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
Adds a param name and doc comment to the next method/function that gets added.
Will also add an override type to the param. Read more
Source§fn ret(&mut self, _: impl IntoDocComment) -> &mut Self
fn ret(&mut self, _: impl IntoDocComment) -> &mut Self
Adds a return doc comment to the next method/function that gets added. Read more
Source§fn ret_as(&mut self, _: impl Into<Type>, _: impl IntoDocComment) -> &mut Self
fn ret_as(&mut self, _: impl Into<Type>, _: 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. Read more
Source§fn index<I: Typed>(
&mut self,
_idx: isize,
_doc: impl IntoDocComment,
) -> &mut Self
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
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
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: Fn(&Lua, &T, A) -> Result<R> + MaybeSend + 'static,
fn add_method<S, A, R, M>(&mut self, name: S, method: M)where
S: Into<String>,
A: FromLuaMulti + TypedMultiValue,
R: IntoLuaMulti + TypedMultiValue,
M: Fn(&Lua, &T, A) -> Result<R> + MaybeSend + 'static,
Exposes a 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: Fn(&Lua, A) -> Result<R> + MaybeSend + 'static,
fn add_function<S, A, R, F>(&mut self, name: S, function: F)where
S: Into<String>,
A: FromLuaMulti + TypedMultiValue,
R: IntoLuaMulti + TypedMultiValue,
F: Fn(&Lua, A) -> Result<R> + MaybeSend + 'static,
Exposes a function to lua (its a method that does not take Self)
Source§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: FnMut(&Lua, &mut T, A) -> Result<R> + MaybeSend + 'static,
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: FnMut(&Lua, &mut T, A) -> Result<R> + MaybeSend + 'static,
Exposes a method to lua that has a mutable reference to Self
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>,
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_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<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,
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_mut<S, A, R, F>(&mut self, name: S, function: F)where
S: Into<String>,
A: FromLuaMulti + TypedMultiValue,
R: IntoLuaMulti + TypedMultiValue,
F: FnMut(&Lua, A) -> Result<R> + MaybeSend + 'static,
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: FnMut(&Lua, A) -> Result<R> + MaybeSend + 'static,
Exposes a mutable function to lua
Source§fn add_meta_function<A, R, F>(&mut self, meta: impl Into<String>, function: F)where
A: FromLuaMulti + TypedMultiValue,
R: IntoLuaMulti + TypedMultiValue,
F: Fn(&Lua, A) -> Result<R> + MaybeSend + 'static,
fn add_meta_function<A, R, F>(&mut self, meta: impl Into<String>, function: F)where
A: FromLuaMulti + TypedMultiValue,
R: IntoLuaMulti + TypedMultiValue,
F: Fn(&Lua, A) -> Result<R> + MaybeSend + 'static,
Exposes a meta function to lua http://lua-users.org/wiki/MetatableEvents
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>>,
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_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_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>,
Exposes a meta and mutable method 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: FnMut(&Lua, A) -> Result<R> + MaybeSend + 'static,
fn add_meta_function_mut<A, R, F>(
&mut self,
meta: impl Into<String>,
function: F,
)where
A: FromLuaMulti + TypedMultiValue,
R: IntoLuaMulti + TypedMultiValue,
F: FnMut(&Lua, A) -> Result<R> + MaybeSend + 'static,
Exposes a meta and mutable function to lua http://lua-users.org/wiki/MetatableEvents
Auto Trait Implementations§
impl<'ctx, U> Freeze for WrappedBuilder<'ctx, U>
impl<'ctx, U> RefUnwindSafe for WrappedBuilder<'ctx, U>where
U: RefUnwindSafe,
impl<'ctx, U> Send for WrappedBuilder<'ctx, U>where
U: Send,
impl<'ctx, U> Sync for WrappedBuilder<'ctx, U>where
U: Sync,
impl<'ctx, U> Unpin for WrappedBuilder<'ctx, U>
impl<'ctx, U> UnsafeUnpin for WrappedBuilder<'ctx, U>
impl<'ctx, U> !UnwindSafe for WrappedBuilder<'ctx, U>
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more