pub enum Type {
Show 14 variants
Number,
String,
Boolean,
Alias(AliasType),
Table(TableType),
Function(FunctionType),
Generic(GenericType),
GenericCall(GenericCallType),
Union(UnionType),
Option(OptionType),
Unknown,
Nil,
Group(GroupType),
Variadic(VariadicType),
}Variants§
Number
String
Boolean
Alias(AliasType)
Table(TableType)
Function(FunctionType)
Generic(GenericType)
GenericCall(GenericCallType)
Union(UnionType)
Option(OptionType)
Unknown
Nil
Group(GroupType)
Variadic(VariadicType)
Implementations§
Source§impl Type
impl Type
pub fn new(name: &str, range: Range) -> Self
pub fn is_nil(&self) -> bool
pub fn is_group(&self) -> bool
pub fn is_variadic(&self) -> bool
pub fn new_variadic(inner_type: Type) -> Self
pub fn new_group(types: Vec<Type>) -> Self
pub fn new_table( array: Option<HashSet<Type>>, map: Option<BTreeMap<String, Type>>, ) -> Self
pub fn new_function(params: Vec<Type>, return_type: Type) -> Self
pub fn new_union(types: Vec<Type>) -> Self
pub fn new_option(inner_type: Type) -> Self
pub fn new_generic( name: &str, variables: Vec<String>, value: Type, range: Range, ) -> Self
pub fn new_generic_call(name: String, types: Vec<Type>, range: Range) -> Self
pub fn new_boolean() -> Self
pub fn check_match(&self, other: &Type) -> bool
pub fn supports_operator(&self, operator: &BinaryOperator) -> bool
pub fn suport_unary_operator(&self, operator: &UnaryOperator) -> bool
pub fn get_unary_operator_result_type(&self, operator: &UnaryOperator) -> Type
pub fn get_operator_result_type( &self, other: &Type, operator: &BinaryOperator, ) -> Type
pub fn can_replace(&self, replaced: &Type) -> bool
pub fn same_group_length(&self, other: &Type) -> bool
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
impl Eq for Type
impl StructuralPartialEq for Type
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