pub struct Type { /* private fields */ }Implementations§
Source§impl Type
impl Type
pub fn kind(&self) -> &TypeKind
pub fn into_kind(self) -> TypeKind
pub fn kind_mut(&mut self) -> &mut TypeKind
pub fn spelling(&self) -> Option<&Spelling>
pub fn spelled(kind: TypeKind, spelling: Spelling) -> Self
pub fn same_spelling_as(&self, other: &Type) -> bool
pub fn written_alias(&self) -> Option<Type>
pub fn without_spelling(&self) -> Type
pub fn carry_spelling( &self, target: Type, map: impl FnMut(&Type) -> Type, ) -> Type
pub fn edit_kind_keeping_spelling( self, edit: impl FnOnce(&mut TypeKind), ) -> Type
Source§impl Type
impl Type
pub fn simple(kind: SimpleKind) -> Type
pub fn never() -> Type
pub fn error(reported: ErrorReported) -> Type
pub fn parameter(name: EcoString) -> Type
pub fn tuple(elements: Vec<Type>) -> Type
pub fn compound(kind: CompoundKind, args: Vec<Type>) -> Type
pub fn qualified_compound( kind: CompoundKind, args: Vec<Type>, writable: bool, ) -> Type
Sourcepub fn contains_write_permission(&self) -> bool
pub fn contains_write_permission(&self) -> bool
Whether a write permission appears anywhere in this type.
Sourcepub fn contains_type_parameter(&self) -> bool
pub fn contains_type_parameter(&self) -> bool
Whether a type parameter appears anywhere in this type.
pub fn is_writable(&self) -> bool
pub fn make_writable(self) -> Type
Sourcepub fn writable_clone_result(&self) -> Type
pub fn writable_clone_result(&self) -> Type
A deep clone’s type: fresh writable storage at every built-in container layer, nominal elements copied shallowly.
Sourcepub fn shallow_demoted(&self) -> Type
pub fn shallow_demoted(&self) -> Type
This type with its own write permission removed, type arguments untouched.
Sourcepub fn demotion_changes(&self) -> bool
pub fn demotion_changes(&self) -> bool
Whether demoted would return a different type. Must mirror demoted.
pub fn demoted(&self) -> Type
pub fn function( params: Vec<FunctionParameter>, bounds: Vec<Bound>, return_type: Box<Type>, ) -> Type
pub fn int() -> Type
pub fn rune() -> Type
pub fn string() -> Type
pub fn bool() -> Type
pub fn unit() -> Type
pub fn test_context() -> Type
pub fn is_test_context(&self) -> bool
Source§impl Type
impl Type
pub fn uninferred() -> Self
pub fn is_uninferred(&self) -> bool
pub fn get_type_params(&self) -> Option<&[Type]>
pub fn without_permissions(&self) -> Type
pub fn map_children(&self, map: impl FnMut(&Type) -> Type) -> Type
Sourcepub fn children(&self) -> TypeChildren<'_> ⓘ
pub fn children(&self) -> TypeChildren<'_> ⓘ
Direct child types, for read-only walks. Excludes Function.bounds.
Source§impl Type
impl Type
pub fn get_function_ret(&self) -> Option<&Type>
pub fn is_stringer_signature(&self, peel: impl Fn(&Type) -> Type) -> bool
pub fn is_equals_signature(&self, peel: impl Fn(&Type) -> Type) -> bool
pub fn is_equals_bound_signature( &self, param_name: &str, peel: impl Fn(&Type) -> Type, ) -> bool
pub fn has_name(&self, name: &str) -> bool
pub fn get_qualified_id(&self) -> Option<&str>
pub fn nominal_id(&self) -> Option<&Symbol>
pub fn is_result(&self) -> bool
pub fn is_option(&self) -> bool
pub fn is_partial(&self) -> bool
pub fn is_value_and_bool(&self) -> bool
pub fn option_of(inner: Type) -> Type
pub fn is_unit(&self) -> bool
pub fn tuple_arity(&self) -> Option<usize>
pub fn is_tuple(&self) -> bool
pub fn is_function(&self) -> bool
pub fn is_nominal(&self) -> bool
pub fn is_type_parameter(&self) -> bool
pub fn is_array(&self) -> bool
pub fn tuple_elements(&self) -> Option<&[Type]>
pub fn array_parts(&self) -> Option<(u64, &Type)>
pub fn array_len(&self) -> Option<u64>
pub fn as_import_namespace(&self) -> Option<&str>
pub fn as_compound(&self) -> Option<(CompoundKind, &[Type])>
pub fn is_native(&self, kind: CompoundKind) -> bool
pub fn is_ref(&self) -> bool
pub fn is_slice(&self) -> bool
pub fn is_map(&self) -> bool
pub fn is_channel(&self) -> bool
pub fn is_receiver_placeholder(&self) -> bool
pub fn is_unknown(&self) -> bool
pub fn is_receiver(&self) -> bool
pub fn is_variadic(&self) -> Option<Type>
pub fn is_string(&self) -> bool
pub fn as_simple(&self) -> Option<SimpleKind>
pub fn is_simple(&self, kind: SimpleKind) -> bool
pub fn is_boolean(&self) -> bool
pub fn is_float(&self) -> bool
pub fn is_variable(&self) -> bool
Sourcepub fn is_structural_alias_body(&self) -> bool
pub fn is_structural_alias_body(&self) -> bool
A transparent alias over this keeps its name, wrapped in a Nominal
that unification peels back to it.
pub fn is_numeric(&self) -> bool
pub fn is_complex(&self) -> bool
pub fn is_unsigned_int(&self) -> bool
pub fn is_never(&self) -> bool
pub fn is_error(&self) -> bool
pub fn contains_error(&self) -> bool
pub fn reported_error(&self) -> Option<ErrorReported>
pub fn has_variables(&self) -> bool
pub fn collect_variables(&self, out: &mut Vec<TypeVarId>)
pub fn has_unbound_variables(&self) -> bool
pub fn collect_unbound_variables(&self, out: &mut Vec<TypeVarId>)
pub fn remove_found_type_names(&self, names: &mut FxHashSet<EcoString>)
Source§impl Type
impl Type
pub fn display_name(&self) -> Option<DisplayName<'_>>
pub fn namespace_name(&self) -> Option<&str>
pub fn wraps(&self, is_wrapper: impl Fn(&Type) -> bool, inner: &Type) -> bool
pub fn get_function_params(&self) -> Option<&[FunctionParameter]>
pub fn param_count(&self) -> usize
pub fn with_replaced_first_param(&self, new_first: &Type) -> Type
pub fn get_bounds(&self) -> &[Bound]
pub fn get_qualified_name(&self) -> Option<Symbol>
pub fn inner(&self) -> Option<Type>
pub fn ok_type(&self) -> Type
pub fn err_type(&self) -> Type
Source§impl Type
impl Type
pub fn as_function_type(&self) -> Option<&FunctionType>
pub fn ref_depth(&self) -> usize
pub fn strip_refs(&self) -> Type
pub fn receiver_shape(&self) -> Type
pub fn points_to_ref(&self) -> bool
pub fn is_option_or_result(&self) -> bool
pub fn tuple_or_type_arguments(&self) -> Vec<Type>
pub fn is_prelude_error(&self) -> bool
pub fn range_type(&self) -> Option<Type>
pub fn with_receiver_placeholder(self) -> Type
pub fn remove_vars(types: &[&Type]) -> (Vec<Type>, Vec<EcoString>)
pub fn contains_type(&self, target: &Type) -> bool
Source§impl Type
impl Type
pub fn numeric_family(&self) -> Option<NumericFamily>
Trait Implementations§
impl Eq for Type
Source§impl FromIterator<Type> for TypeList
impl FromIterator<Type> for TypeList
Auto Trait Implementations§
impl Forget for Type
impl Freeze for Typewhere
*const ArcInner<Box<[Type]>> is !null: Freeze,
PhantomData<ArcInner<Box<[Type]>>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<FunctionType> is !null: Freeze,
PhantomData<ArcInner<FunctionType>>: Freeze,
PhantomData<Type>: Freeze,
*const Type is !null: Freeze,
*const ArcInner<Spelling> is !null: Freeze,
PhantomData<ArcInner<Spelling>>: Freeze,
impl Move for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin for Typewhere
*const ArcInner<Box<[Type]>> is !null: UnsafeUnpin,
PhantomData<ArcInner<Box<[Type]>>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<FunctionType> is !null: UnsafeUnpin,
PhantomData<ArcInner<FunctionType>>: UnsafeUnpin,
PhantomData<Type>: UnsafeUnpin,
*const Type is !null: UnsafeUnpin,
*const ArcInner<Spelling> is !null: UnsafeUnpin,
PhantomData<ArcInner<Spelling>>: UnsafeUnpin,
impl UnwindSafe for Typewhere
Arc<Box<[Type]>>: UnwindSafe,
NonNull<u8>: UnwindSafe,
Arc<FunctionType>: UnwindSafe,
RawVecInner: UnwindSafe,
BoxRaw<Type>: UnwindSafe,
Arc<Spelling>: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToEcoString for T
impl<T> ToEcoString for T
Source§fn to_eco_string(&self) -> EcoString
fn to_eco_string(&self) -> EcoString
Converts the given value to an
EcoString.