pub enum Type {
Function(FunctionRepresentation),
Single(SingleType),
Map(MapRepresentation),
Or(Vec<Type>),
Array(Box<Type>),
Tuple(Vec<Type>),
}
Expand description
A type
Variants§
Function(FunctionRepresentation)
The type is a function
Single(SingleType)
The type is a simple, singular type
Map(MapRepresentation)
The type is a Map<K,V> (Think HashMap<K,V> and similar)
Or(Vec<Type>)
The type is a union (A | B)
Array(Box<Type>)
The type is an array
Tuple(Vec<Type>)
This one doesn’t really exist in lua/teal but will expand in (A,B,C) Sometimes useful for the return type or parameters but should be used very carefully As it can easily break things
Implementations§
Source§impl Type
impl Type
Sourcepub fn new_single(name: impl AsRef<str>, kind: KindOfType) -> Self
pub fn new_single(name: impl AsRef<str>, kind: KindOfType) -> Self
Creates a new singular type
Examples found in repository?
More examples
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Type
impl<'de> Deserialize<'de> for Type
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl TealData for Type
impl TealData for Type
Source§fn add_fields<F: TealDataFields<Self>>(fields: &mut F)
fn add_fields<F: TealDataFields<Self>>(fields: &mut F)
same as UserData::add_fields.
Refer to its documentation on how to use it. Read more
Source§fn add_methods<T: TealDataMethods<Self>>(methods: &mut T)
fn add_methods<T: TealDataMethods<Self>>(methods: &mut T)
same as UserData::add_methods.
Refer to its documentation on how to use it. Read more
Source§impl ToTypename for Type
impl ToTypename for Type
Source§fn to_typename() -> Type
fn to_typename() -> Type
generates the type representation
Source§fn to_old_type_parts() -> Cow<'static, [NamePart]>
fn to_old_type_parts() -> Cow<'static, [NamePart]>
👎Deprecated
Used to get the old representation.
Should basically never be used or implemented manually
Source§fn to_function_param() -> Vec<FunctionParam>
fn to_function_param() -> Vec<FunctionParam>
generates the type representation when used as a parameter
By default will assume no name was given Read more
Source§impl TypeBody for Type
impl TypeBody for Type
Source§fn get_type_body() -> TypeGenerator
fn get_type_body() -> TypeGenerator
Fills in the TypeGenerator so a .d.tl file can be constructed.
Source§impl UserData for Type
impl UserData for Type
Source§fn add_fields<F: UserDataFields<Self>>(fields: &mut F)
fn add_fields<F: UserDataFields<Self>>(fields: &mut F)
Adds custom fields specific to this userdata.
Source§fn add_methods<M: UserDataMethods<Self>>(methods: &mut M)
fn add_methods<M: UserDataMethods<Self>>(methods: &mut M)
Adds custom methods and operators specific to this userdata.
Source§fn register(registry: &mut UserDataRegistry<Self>)
fn register(registry: &mut UserDataRegistry<Self>)
Registers this type for use in Lua. Read more
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FromLuaMulti for Twhere
T: FromLua,
impl<T> FromLuaMulti for Twhere
T: FromLua,
Source§fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
fn from_lua_multi(values: MultiValue, lua: &Lua) -> Result<T, Error>
Performs the conversion. Read more
fn from_lua_args( args: MultiValue, i: usize, to: Option<&str>, lua: &Lua, ) -> Result<T, Error>
unsafe fn from_stack_multi(nvals: i32, lua: &RawLua) -> Result<T, Error>
unsafe fn from_stack_args( nargs: i32, i: usize, to: Option<&str>, lua: &RawLua, ) -> Result<T, Error>
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 moreSource§impl<T> IntoLuaMulti for Twhere
T: IntoLua,
impl<T> IntoLuaMulti for Twhere
T: IntoLua,
Source§fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
fn into_lua_multi(self, lua: &Lua) -> Result<MultiValue, Error>
Performs the conversion.
unsafe fn push_into_stack_multi(self, lua: &RawLua) -> Result<i32, Error>
Source§impl<T> Serialize for T
impl<T> Serialize for T
fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>
fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>
Source§impl<A> TealMultiValue for Awhere
A: ToTypename,
impl<A> TealMultiValue for Awhere
A: ToTypename,
Source§fn get_types_as_params() -> Vec<FunctionParam>
fn get_types_as_params() -> Vec<FunctionParam>
Gets the type representations as used for function parameters
Source§impl<T> TypeName for Twhere
T: ToTypename,
impl<T> TypeName for Twhere
T: ToTypename,
Source§fn get_type_parts() -> Cow<'static, [NamePart]>
fn get_type_parts() -> Cow<'static, [NamePart]>
returns the type name as how it should show up in the generated
.d.tl
fileSource§fn get_type_parts_as_global() -> Cow<'static, [NamePart]>
fn get_type_parts_as_global() -> Cow<'static, [NamePart]>
Generates the typename when used to describe a global value. Read more
Source§fn get_type_kind() -> KindOfType
fn get_type_kind() -> KindOfType
This method tells the generator if this type is builtin to teal/lua, if it comes from somewhere else or if it stands in as a generic Read more
Source§fn collect_children(_: &mut Vec<TealType>)
fn collect_children(_: &mut Vec<TealType>)
Creates/updates a list of every child type this type has
This is used to properly label methods/functions as being generic.