pub enum Type {
Unknown,
Boolean,
Integer,
Real,
Array {
elem: Box<Type>,
size: usize,
},
Tuple(Vec<Type>),
}Variants§
Unknown
Returned when an identifier cannot be resolved, or from an operator when it cannot resolve its type due to an operand being unknown to.
Boolean
Integer
Real
Array
Tuple(Vec<Type>)
Tuple value or return type of a function with multiple (or 0) values
A tuple cannot contain only one element, but may be empty. More specifically, if a
function returns exactly one value, it mustn’t be typed as a ReturnTuple as this would
prevent it from being used as an operand to pretty much all operators.
Implementations§
Source§impl Type
impl Type
pub fn is_array(&self) -> bool
pub fn is_numeric(&self) -> bool
pub fn is_unknown(&self) -> bool
Sourcepub fn or(self, other: Self) -> Type
pub fn or(self, other: Self) -> Type
Returns the first non-Unknown type between Self and other, and
Type::Unknown if both are
Sourcepub fn numeric_or(self, other: Self) -> Type
pub fn numeric_or(self, other: Self) -> Type
Returns the first non-Unknown numeric type between Self and other,
and Type::Unknown if both are unknown or non-numeric
pub fn is_assignable_from(&self, other: &Self) -> bool
Trait Implementations§
Source§impl Ord for Type
impl Ord for Type
Source§impl PartialOrd for Type
impl PartialOrd for Type
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