Trait tealr::mlu::TealDataFields

source ·
pub trait TealDataFields<'lua, T: TealData> {
    // Required methods
    fn document(&mut self, documentation: &str);
    fn add_field_method_get<S, R, M>(&mut self, name: &S, method: M)
       where S: AsRef<str> + ?Sized,
             R: IntoLua<'lua> + ToTypename,
             M: 'static + MaybeSend + Fn(&'lua Lua, &T) -> Result<R>;
    fn add_field_method_set<S, A, M>(&mut self, name: &S, method: M)
       where S: AsRef<str> + ?Sized,
             A: FromLua<'lua> + ToTypename,
             M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<()>;
    fn add_field_function_get<S, R, F>(&mut self, name: &S, function: F)
       where S: AsRef<str> + ?Sized,
             R: IntoLua<'lua> + ToTypename,
             F: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>) -> Result<R>;
    fn add_field_function_set<S, A, F>(&mut self, name: &S, function: F)
       where S: AsRef<str> + ?Sized,
             A: FromLua<'lua> + ToTypename,
             F: 'static + MaybeSend + FnMut(&'lua Lua, AnyUserData<'lua>, A) -> Result<()>;
    fn add_meta_field_with<R, F>(&mut self, meta: MetaMethod, f: F)
       where F: 'static + MaybeSend + Fn(&'lua Lua) -> Result<R>,
             R: IntoLua<'lua> + ToTypename;
}
Expand description

The teal version of UserDataFields

The meaning of every method is the same, and so is its use. Look at mlua for documentation

The only 2 differences are that TealDataFields has an extra type bound on R. These are to get the type names when generating the .d.tl file.

Required Methods§

source

fn document(&mut self, documentation: &str)

Adds documentation to the next field that gets added

source

fn add_field_method_get<S, R, M>(&mut self, name: &S, method: M)
where S: AsRef<str> + ?Sized, R: IntoLua<'lua> + ToTypename, M: 'static + MaybeSend + Fn(&'lua Lua, &T) -> Result<R>,

the teal version of UserDataFields

source

fn add_field_method_set<S, A, M>(&mut self, name: &S, method: M)
where S: AsRef<str> + ?Sized, A: FromLua<'lua> + ToTypename, M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> Result<()>,

the teal version of UserDataFields

source

fn add_field_function_get<S, R, F>(&mut self, name: &S, function: F)
where S: AsRef<str> + ?Sized, R: IntoLua<'lua> + ToTypename, F: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>) -> Result<R>,

the teal version of UserDataFields

source

fn add_field_function_set<S, A, F>(&mut self, name: &S, function: F)
where S: AsRef<str> + ?Sized, A: FromLua<'lua> + ToTypename, F: 'static + MaybeSend + FnMut(&'lua Lua, AnyUserData<'lua>, A) -> Result<()>,

the teal version of UserDataFields

source

fn add_meta_field_with<R, F>(&mut self, meta: MetaMethod, f: F)
where F: 'static + MaybeSend + Fn(&'lua Lua) -> Result<R>, R: IntoLua<'lua> + ToTypename,

the teal version of UserDataFields

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, 'lua, Container, T> TealDataFields<'lua, T> for UserDataWrapper<'a, 'lua, Container, T>
where T: UserData + ToTypename + TealData, Container: UserDataFields<'lua, T>,

source§

impl<'lua, T> TealDataFields<'lua, T> for RecordGenerator
where T: 'static + TealDataM + UserDataM + ToTypename,