pub struct SubrType {
pub kind: SubrKind,
pub non_default_params: Vec<ParamTy>,
pub var_params: Option<Box<ParamTy>>,
pub default_params: Vec<ParamTy>,
pub kw_var_params: Option<Box<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>
§kw_var_params: Option<Box<ParamTy>>
§return_t: Box<Type>
Implementations§
Source§impl SubrType
impl SubrType
pub fn failed() -> Self
pub fn new( kind: SubrKind, non_default_params: Vec<ParamTy>, var_params: Option<ParamTy>, default_params: Vec<ParamTy>, kw_var_params: Option<ParamTy>, return_t: Type, ) -> Self
pub fn contains_tvar(&self, target: &FreeTyVar) -> bool
pub fn contains_type(&self, target: &Type) -> bool
pub fn contains_tp(&self, target: &TyParam) -> bool
pub fn map(self, f: &mut impl FnMut(Type) -> Type) -> Self
pub fn map_tp( self, f: &mut impl FnMut(TyParam) -> TyParam, tvs: &SharedFrees, ) -> Self
pub fn try_map_tp<E>( self, f: &mut impl FnMut(TyParam) -> Result<TyParam, E>, tvs: &SharedFrees, ) -> Result<Self, E>
pub fn contains_value(&self, target: &ValueObj) -> 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_type_satisfies(&self, f: impl Fn(&Type) -> bool + Copy) -> bool
pub fn has_qvar(&self) -> bool
pub fn has_unbound_var(&self) -> bool
pub fn has_undoable_linked_var(&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
Sourcepub fn pos_params(&self) -> impl Iterator<Item = &ParamTy> + Clone
pub fn pos_params(&self) -> impl Iterator<Item = &ParamTy> + Clone
WARN: This is an infinite iterator
self
is not included
pub fn param_names(&self) -> impl Iterator<Item = &str> + Clone
pub fn param_ts(&self) -> impl Iterator<Item = &Type> + Clone
pub fn is_no_var(&self) -> bool
pub fn derefine(&self) -> Self
pub fn args_ownership(&self) -> ArgsOwnership
pub fn _replace(self, target: &Type, to: &Type, tvs: &SharedFrees) -> Self
pub fn _replace_tp( self, target: &TyParam, to: &TyParam, tvs: &SharedFrees, ) -> Self
pub fn replace_params(self, target_and_to: Vec<(Str, Str)>) -> Self
pub fn destructive_coerce(&self)
Trait Implementations§
Source§impl LimitedDisplay for SubrType
impl LimitedDisplay for SubrType
Source§fn limited_fmt<W: Write>(&self, f: &mut W, limit: isize) -> Result
fn limited_fmt<W: Write>(&self, f: &mut W, limit: isize) -> Result
If
limit
was set to a negative value, it will be displayed without abbreviation.
FIXME:fn to_string_unabbreviated(&self) -> String
const DEFAULT_LIMIT: isize = 10isize
Source§impl StructuralEq for SubrType
impl StructuralEq for SubrType
fn structural_eq(&self, other: &Self) -> bool
impl Eq for SubrType
impl StructuralPartialEq for SubrType
Auto Trait Implementations§
impl Freeze for SubrType
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