Struct tealr::RecordGenerator
source · pub struct RecordGenerator {Show 16 fields
pub should_be_inlined: bool,
pub is_user_data: bool,
pub type_name: Cow<'static, [NamePart]>,
pub fields: Vec<Field>,
pub static_fields: Vec<Field>,
pub methods: Vec<ExportedFunction>,
pub mut_methods: Vec<ExportedFunction>,
pub functions: Vec<ExportedFunction>,
pub mut_functions: Vec<ExportedFunction>,
pub meta_method: Vec<ExportedFunction>,
pub meta_method_mut: Vec<ExportedFunction>,
pub meta_function: Vec<ExportedFunction>,
pub meta_function_mut: Vec<ExportedFunction>,
pub documentation: HashMap<NameContainer, String>,
pub type_doc: String,
pub should_generate_help_method: bool,
/* private fields */
}
Expand description
contains all the information needed to create a record
Fields§
§should_be_inlined: bool
Represents if the type should be inlined or not.
is_user_data: bool
Represents if the type is UserData
type_name: Cow<'static, [NamePart]>
The name of the type in teal
fields: Vec<Field>
The exposed fields and their types
static_fields: Vec<Field>
The exposed static fields and their types
methods: Vec<ExportedFunction>
exported methods
mut_methods: Vec<ExportedFunction>
exported methods that mutate something
functions: Vec<ExportedFunction>
exported functions
mut_functions: Vec<ExportedFunction>
exported functions that mutate something
meta_method: Vec<ExportedFunction>
exported meta_methods
meta_method_mut: Vec<ExportedFunction>
exported meta_methods that mutate something
meta_function: Vec<ExportedFunction>
exported meta functions
meta_function_mut: Vec<ExportedFunction>
exported meta functions that mutate something
documentation: HashMap<NameContainer, String>
registered documentation
type_doc: String
documentation for this type itself
should_generate_help_method: bool
if this type needs to get a .help()
function
Implementations§
source§impl RecordGenerator
impl RecordGenerator
sourcepub fn new<A: ToTypename>(should_be_inlined: bool) -> Self
pub fn new<A: ToTypename>(should_be_inlined: bool) -> Self
creates a new RecordGenerator
Examples found in repository?
More examples
source§impl RecordGenerator
impl RecordGenerator
sourcepub fn copy_docs(&mut self, to: &[u8])
pub fn copy_docs(&mut self, to: &[u8])
copies the documentation stored in “next_docs” to be linked to the given name Shouldn’t be called manually unless you add the fields/methods by hand rather than using the functions for this.
sourcepub fn document_type(&mut self, documentation: &str) -> &mut Self
pub fn document_type(&mut self, documentation: &str) -> &mut Self
adds documentation to the type itself
Trait Implementations§
source§impl Clone for RecordGenerator
impl Clone for RecordGenerator
source§fn clone(&self) -> RecordGenerator
fn clone(&self) -> RecordGenerator
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Default for RecordGenerator
impl Default for RecordGenerator
source§fn default() -> RecordGenerator
fn default() -> RecordGenerator
source§impl<'de> Deserialize<'de> for RecordGenerator
impl<'de> Deserialize<'de> for RecordGenerator
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl From<Box<RecordGenerator>> for RecordGenerator
impl From<Box<RecordGenerator>> for RecordGenerator
source§fn from(x: Box<RecordGenerator>) -> Self
fn from(x: Box<RecordGenerator>) -> Self
source§impl From<RecordGenerator> for TypeGenerator
impl From<RecordGenerator> for TypeGenerator
source§fn from(a: RecordGenerator) -> Self
fn from(a: RecordGenerator) -> Self
source§impl Serialize for RecordGenerator
impl Serialize for RecordGenerator
source§impl<'lua, T> TealDataFields<'lua, T> for RecordGenerator
impl<'lua, T> TealDataFields<'lua, T> for RecordGenerator
source§fn add_field_method_get<S, R, M>(&mut self, name: &S, _: M)
fn add_field_method_get<S, R, M>(&mut self, name: &S, _: M)
source§fn add_field_method_set<S, A, M>(&mut self, name: &S, _: M)
fn add_field_method_set<S, A, M>(&mut self, name: &S, _: M)
source§fn add_field_function_get<S, R, F>(&mut self, name: &S, _: F)where
S: AsRef<str> + ?Sized,
R: IntoLua<'lua> + ToTypename,
F: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>) -> Result<R>,
fn add_field_function_get<S, R, F>(&mut self, name: &S, _: F)where
S: AsRef<str> + ?Sized,
R: IntoLua<'lua> + ToTypename,
F: 'static + MaybeSend + Fn(&'lua Lua, AnyUserData<'lua>) -> Result<R>,
source§fn add_field_function_set<S, A, F>(&mut self, name: &S, _: F)
fn add_field_function_set<S, A, F>(&mut self, name: &S, _: F)
source§fn add_meta_field_with<R, F>(&mut self, meta: MetaMethodM, _: F)
fn add_meta_field_with<R, F>(&mut self, meta: MetaMethodM, _: F)
source§impl<'lua, T> TealDataMethods<'lua, T> for RecordGenerator
impl<'lua, T> TealDataMethods<'lua, T> for RecordGenerator
source§fn add_method<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> ResultM<R>,
fn add_method<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> ResultM<R>,
source§fn add_method_mut<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> ResultM<R>,
fn add_method_mut<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> ResultM<R>,
source§fn add_function<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + Fn(&'lua Lua, A) -> ResultM<R>,
fn add_function<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + Fn(&'lua Lua, A) -> ResultM<R>,
source§fn add_function_mut<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> ResultM<R>,
fn add_function_mut<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> ResultM<R>,
source§fn add_meta_method<A, R, M>(&mut self, name: MetaMethodM, _: M)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> ResultM<R>,
fn add_meta_method<A, R, M>(&mut self, name: MetaMethodM, _: M)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + Fn(&'lua Lua, &T, A) -> ResultM<R>,
source§fn add_meta_method_mut<A, R, M>(&mut self, name: MetaMethodM, _: M)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> ResultM<R>,
fn add_meta_method_mut<A, R, M>(&mut self, name: MetaMethodM, _: M)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
M: 'static + MaybeSend + FnMut(&'lua Lua, &mut T, A) -> ResultM<R>,
source§fn add_meta_function<A, R, F>(&mut self, name: MetaMethodM, _: F)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + Fn(&'lua Lua, A) -> ResultM<R>,
fn add_meta_function<A, R, F>(&mut self, name: MetaMethodM, _: F)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + Fn(&'lua Lua, A) -> ResultM<R>,
source§fn add_meta_function_mut<A, R, F>(&mut self, name: MetaMethodM, _: F)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> ResultM<R>,
fn add_meta_function_mut<A, R, F>(&mut self, name: MetaMethodM, _: F)where
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + FnMut(&'lua Lua, A) -> ResultM<R>,
source§fn add_async_method<'s, S: ?Sized + AsRef<str>, A, R, M, MR>(
&mut self,
name: &S,
_: M
)where
T: 'static,
M: Fn(&'lua Lua, &'s T, A) -> MR + MaybeSend + 'static,
A: FromLuaMultiM<'lua> + TealMultiValue,
MR: Future<Output = ResultM<R>> + 's,
R: ToLuaMultiM<'lua> + TealMultiValue,
'lua: 's,
fn add_async_method<'s, S: ?Sized + AsRef<str>, A, R, M, MR>(
&mut self,
name: &S,
_: M
)where
T: 'static,
M: Fn(&'lua Lua, &'s T, A) -> MR + MaybeSend + 'static,
A: FromLuaMultiM<'lua> + TealMultiValue,
MR: Future<Output = ResultM<R>> + 's,
R: ToLuaMultiM<'lua> + TealMultiValue,
'lua: 's,
source§fn add_async_function<S, A, R, F, FR>(&mut self, name: &S, _: F)where
S: AsRef<str> + ?Sized,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + Fn(&'lua Lua, A) -> FR,
FR: 'lua + Future<Output = ResultM<R>>,
fn add_async_function<S, A, R, F, FR>(&mut self, name: &S, _: F)where
S: AsRef<str> + ?Sized,
A: FromLuaMultiM<'lua> + TealMultiValue,
R: ToLuaMultiM<'lua> + TealMultiValue,
F: 'static + MaybeSend + Fn(&'lua Lua, A) -> FR,
FR: 'lua + Future<Output = ResultM<R>>,
source§fn generate_help(&mut self)
fn generate_help(&mut self)
.help()
function on lua’s/teals side, which can be used at run time to view the documentation.source§fn document(&mut self, documentation: &str) -> &mut Self
fn document(&mut self, documentation: &str) -> &mut Self
source§fn document_type(&mut self, documentation: &str) -> &mut Self
fn document_type(&mut self, documentation: &str) -> &mut Self
source§impl<'lua, T> TealDataMethods<'lua, T> for RecordGenerator
impl<'lua, T> TealDataMethods<'lua, T> for RecordGenerator
source§fn add_method<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + Fn(Context<'lua>, &T, A) -> ResultR<R>,
fn add_method<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + Fn(Context<'lua>, &T, A) -> ResultR<R>,
source§fn add_method_mut<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + FnMut(Context<'lua>, &mut T, A) -> ResultR<R>,
fn add_method_mut<S, A, R, M>(&mut self, name: &S, _: M)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + FnMut(Context<'lua>, &mut T, A) -> ResultR<R>,
source§fn add_function<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + Fn(Context<'lua>, A) -> ResultR<R>,
fn add_function<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + Fn(Context<'lua>, A) -> ResultR<R>,
source§fn add_function_mut<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + FnMut(Context<'lua>, A) -> ResultR<R>,
fn add_function_mut<S, A, R, F>(&mut self, name: &S, _: F)where
S: ?Sized + AsRef<str>,
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + FnMut(Context<'lua>, A) -> ResultR<R>,
source§fn add_meta_method<A, R, M>(&mut self, name: MetaMethodR, _: M)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + Fn(Context<'lua>, &T, A) -> ResultR<R>,
fn add_meta_method<A, R, M>(&mut self, name: MetaMethodR, _: M)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + Fn(Context<'lua>, &T, A) -> ResultR<R>,
source§fn add_meta_method_mut<A, R, M>(&mut self, name: MetaMethodR, _: M)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + FnMut(Context<'lua>, &mut T, A) -> ResultR<R>,
fn add_meta_method_mut<A, R, M>(&mut self, name: MetaMethodR, _: M)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
M: 'static + Send + FnMut(Context<'lua>, &mut T, A) -> ResultR<R>,
source§fn add_meta_function<A, R, F>(&mut self, name: MetaMethodR, _: F)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + Fn(Context<'lua>, A) -> ResultR<R>,
fn add_meta_function<A, R, F>(&mut self, name: MetaMethodR, _: F)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + Fn(Context<'lua>, A) -> ResultR<R>,
source§fn add_meta_function_mut<A, R, F>(&mut self, name: MetaMethodR, _: F)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + FnMut(Context<'lua>, A) -> ResultR<R>,
fn add_meta_function_mut<A, R, F>(&mut self, name: MetaMethodR, _: F)where
A: FromLuaMultiR<'lua> + TealMultiValue,
R: ToLuaMultiR<'lua> + TealMultiValue,
F: 'static + Send + FnMut(Context<'lua>, A) -> ResultR<R>,
source§fn document(&mut self, documentation: &str) -> &mut Self
fn document(&mut self, documentation: &str) -> &mut Self
source§fn generate_help(&mut self)
fn generate_help(&mut self)
instance.help()
function on lua’s/teals side, which can be used at run time to view the documentation.