Struct erg_compiler::ty::SubrType
source · pub struct SubrType {
pub kind: SubrKind,
pub non_default_params: Vec<ParamTy>,
pub var_params: Option<Box<ParamTy>>,
pub default_params: Vec<ParamTy>,
pub return_t: Box<Type>,
}
Expand description
e.g. (x: Int, ?base: Int) -> Int => SubrTy{ kind: Func, non_default_params: [x: Int], default_params: [base: Int] return_t: Int }
Fields§
§kind: SubrKind
§non_default_params: Vec<ParamTy>
§var_params: Option<Box<ParamTy>>
§default_params: Vec<ParamTy>
§return_t: Box<Type>
Implementations§
source§impl SubrType
impl SubrType
pub fn new( kind: SubrKind, non_default_params: Vec<ParamTy>, var_params: Option<ParamTy>, default_params: Vec<ParamTy>, return_t: Type ) -> Self
pub fn contains_tvar(&self, target: &FreeTyVar) -> bool
pub fn contains(&self, target: &Type) -> bool
pub fn qvars(&self) -> Set<(Str, Constraint)>
sourcepub fn essential_qnames(&self) -> Set<Str>
pub fn essential_qnames(&self) -> Set<Str>
essential_qnames(|T, U| (T, U) -> Int) == {}
essential_qnames(|T, U| (T, U) -> (T, U)) == {T, U}
essential_qnames(|T, A| (T) -> A(<: T)) == {T}
essential_qnames(|T, U| (T, T) -> U) == {T}
pub fn has_qvar(&self) -> bool
pub fn typarams(&self) -> Vec<TyParam>
pub fn self_t(&self) -> Option<&Type>
pub fn mut_self_t(&mut self) -> Option<&mut Type>
pub fn is_method(&self) -> bool
pub fn non_var_params(&self) -> impl Iterator<Item = &ParamTy> + Clone
pub fn param_names(&self) -> impl Iterator<Item = &str> + Clone
Trait Implementations§
source§impl LimitedDisplay for SubrType
impl LimitedDisplay for SubrType
source§impl PartialEq<SubrType> for SubrType
impl PartialEq<SubrType> for SubrType
source§impl StructuralEq for SubrType
impl StructuralEq for SubrType
fn structural_eq(&self, other: &Self) -> bool
impl Eq for SubrType
impl StructuralEq for SubrType
impl StructuralPartialEq for SubrType
Auto Trait Implementations§
impl !RefUnwindSafe for SubrType
impl !Send for SubrType
impl !Sync for SubrType
impl Unpin for SubrType
impl !UnwindSafe for SubrType
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