pub trait TypedDataFields<T> {
// Required methods
fn document(&mut self, doc: impl IntoDocComment) -> &mut Self;
fn coerce(&mut self, ty: impl Into<Type>) -> &mut Self;
fn add_field<V>(&mut self, name: impl Into<String>, value: V)
where V: IntoLua + Clone + 'static + Typed;
fn add_field_method_get<S, R, M>(&mut self, name: S, method: M)
where S: Into<String>,
R: IntoLua + Typed,
M: 'static + MaybeSend + Fn(&Lua, &T) -> Result<R>;
fn add_field_method_set<S, A, M>(&mut self, name: S, method: M)
where S: Into<String>,
A: FromLua + Typed,
M: 'static + MaybeSend + FnMut(&Lua, &mut T, A) -> Result<()>;
fn add_field_method_get_set<S, R, A, GET, SET>(
&mut self,
name: S,
get: GET,
set: SET,
)
where S: Into<String>,
R: IntoLua + Typed,
A: FromLua + Typed,
GET: 'static + MaybeSend + Fn(&Lua, &T) -> Result<R>,
SET: 'static + MaybeSend + Fn(&Lua, &mut T, A) -> Result<()>;
fn add_field_function_get<S, R, F>(&mut self, name: S, function: F)
where S: Into<String>,
R: IntoLua + Typed,
F: 'static + MaybeSend + Fn(&Lua, AnyUserData) -> Result<R>;
fn add_field_function_set<S, A, F>(&mut self, name: S, function: F)
where S: Into<String>,
A: FromLua + Typed,
F: 'static + MaybeSend + FnMut(&Lua, AnyUserData, A) -> Result<()>;
fn add_field_function_get_set<S, R, A, GET, SET>(
&mut self,
name: S,
get: GET,
set: SET,
)
where S: Into<String>,
R: IntoLua + Typed,
A: FromLua + Typed,
GET: 'static + MaybeSend + Fn(&Lua, AnyUserData) -> Result<R>,
SET: 'static + MaybeSend + Fn(&Lua, AnyUserData, A) -> Result<()>;
fn add_meta_field<V>(&mut self, meta: impl Into<String>, value: V)
where V: IntoLua + Typed + 'static;
fn add_meta_field_with<R, F>(&mut self, meta: impl Into<String>, f: F)
where F: 'static + MaybeSend + Fn(&Lua) -> Result<R>,
R: IntoLua + Typed + 'static;
}Expand description
Typed variant of mlua::UserDataFields
Required Methods§
Sourcefn 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
Sourcefn 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.
It will be used on the next field and will override the type that is automatically used.
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn add_meta_field<V>(&mut self, meta: impl Into<String>, value: V)
fn add_meta_field<V>(&mut self, meta: impl Into<String>, value: V)
Typed version of add_meta_field
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.