pub enum Type {
Show 40 variants
Obj,
Int,
Nat,
Ratio,
Float,
Bool,
Str,
NoneType,
Code,
Module,
Frame,
Error,
Inf,
NegInf,
Type,
Class,
Trait,
Patch,
NotImplemented,
Ellipsis,
Never,
BuiltinMono(Str),
Mono {
path: Str,
name: Str,
},
Ref(Box<Type>),
RefMut {
before: Box<Type>,
after: Option<Box<Type>>,
},
Subr(SubrType),
Callable {
param_ts: Vec<Type>,
return_t: Box<Type>,
},
Record(Dict<Field, Type>),
Refinement(RefinementType),
Quantified(QuantifiedType),
And(Box<Type>, Box<Type>),
Not(Box<Type>, Box<Type>),
Or(Box<Type>, Box<Type>),
Poly {
name: Str,
params: Vec<TyParam>,
},
MonoQVar(Str),
PolyQVar {
name: Str,
params: Vec<TyParam>,
},
MonoProj {
lhs: Box<Type>,
rhs: Str,
},
FreeVar(FreeTyVar),
Failure,
Uninited,
}
Variants
Obj
Int
Nat
Ratio
Float
Bool
Str
NoneType
Code
Module
Frame
Error
Inf
NegInf
Type
Class
Trait
Patch
NotImplemented
Ellipsis
Never
BuiltinMono(Str)
Mono
Ref(Box<Type>)
RefMut
Subr(SubrType)
Callable
Record(Dict<Field, Type>)
Refinement(RefinementType)
Quantified(QuantifiedType)
And(Box<Type>, Box<Type>)
Not(Box<Type>, Box<Type>)
Or(Box<Type>, Box<Type>)
Poly
MonoQVar(Str)
PolyQVar
MonoProj
FreeVar(FreeTyVar)
Failure
Uninited
used to represent TyParam
is not initialized (see erg_compiler::context::instantiate_tp
)
Implementations
sourceimpl Type
impl Type
pub const OBJ: &'static Self = _
pub const NONE: &'static Self = _
pub const NOT_IMPLEMENTED: &'static Self = _
pub const ELLIPSIS: &'static Self = _
pub const INF: &'static Self = _
pub const NEG_INF: &'static Self = _
pub const NEVER: &'static Self = _
pub const FAILURE: &'static Self = _
pub fn is_mono_q(&self) -> bool
pub fn is_simple_class(&self) -> bool
pub fn is_mut(&self) -> bool
pub fn is_nonelike(&self) -> bool
pub fn is_type(&self) -> bool
pub fn contains_tvar(&self, name: &str) -> bool
pub fn args_ownership(&self) -> ArgsOwnership
pub fn ownership(&self) -> Ownership
pub fn name(&self) -> Str
sourcepub fn contains_intersec(&self, typ: &Type) -> bool
pub fn contains_intersec(&self, typ: &Type) -> bool
assert!((A and B).contains_intersec(B))
pub fn tvar_name(&self) -> Option<Str>
pub const fn is_free_var(&self) -> bool
pub fn is_monomorphic(&self) -> bool
pub const fn is_callable(&self) -> bool
pub fn is_unbound_var(&self) -> bool
pub fn has_qvar(&self) -> bool
pub fn is_cachable(&self) -> bool
pub fn has_unbound_var(&self) -> bool
pub fn has_no_unbound_var(&self) -> bool
pub fn typarams_len(&self) -> Option<usize>
pub fn typarams(&self) -> Vec<TyParam>
pub fn self_t(&self) -> Option<&Type>
pub fn non_default_params(&self) -> Option<&Vec<ParamTy>>
pub fn var_args(&self) -> Option<&ParamTy>
pub fn default_params(&self) -> Option<&Vec<ParamTy>>
pub fn return_t(&self) -> Option<&Type>
pub fn mut_return_t(&mut self) -> Option<&mut Type>
pub fn update_constraint(&self, new_constraint: Constraint)
pub fn update_cyclicity(&self, new_cyclicity: Cyclicity)
Trait Implementations
sourceimpl From<RangeInclusive<&TyParam>> for Type
impl From<RangeInclusive<&TyParam>> for Type
sourcefn from(r: RangeInclusive<&TyParam>) -> Self
fn from(r: RangeInclusive<&TyParam>) -> Self
Converts to this type from the input type.
sourceimpl From<RangeInclusive<TyParam>> for Type
impl From<RangeInclusive<TyParam>> for Type
sourcefn from(r: RangeInclusive<TyParam>) -> Self
fn from(r: RangeInclusive<TyParam>) -> Self
Converts to this type from the input type.
sourceimpl LimitedDisplay for Type
impl LimitedDisplay for Type
fn limited_fmt(&self, f: &mut Formatter<'_>, limit: usize) -> Result
impl Eq for Type
Auto Trait Implementations
impl !RefUnwindSafe for Type
impl !Send for Type
impl !Sync for Type
impl Unpin for Type
impl !UnwindSafe for Type
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more