Skip to main content

Type

Struct Type 

Source
pub struct Type { /* private fields */ }

Implementations§

Source§

impl Type

Source

pub fn stringify(&self) -> String

Source

pub fn stringify_pair(first: &Self, second: &Self) -> (String, String)

Source§

impl Type

Source

pub fn kind(&self) -> &TypeKind

Source

pub fn into_kind(self) -> TypeKind

Source

pub fn kind_mut(&mut self) -> &mut TypeKind

Source

pub fn spelling(&self) -> Option<&Spelling>

Source

pub fn spelled(kind: TypeKind, spelling: Spelling) -> Self

Source

pub fn same_spelling_as(&self, other: &Type) -> bool

Source

pub fn written_alias(&self) -> Option<Type>

Source

pub fn without_spelling(&self) -> Type

Source

pub fn carry_spelling( &self, target: Type, map: impl FnMut(&Type) -> Type, ) -> Type

Source

pub fn edit_kind_keeping_spelling( self, edit: impl FnOnce(&mut TypeKind), ) -> Type

Source§

impl Type

Source

pub fn simple(kind: SimpleKind) -> Type

Source

pub fn never() -> Type

Source

pub fn error(reported: ErrorReported) -> Type

Source

pub fn parameter(name: EcoString) -> Type

Source

pub fn tuple(elements: Vec<Type>) -> Type

Source

pub fn compound(kind: CompoundKind, args: Vec<Type>) -> Type

Source

pub fn qualified_compound( kind: CompoundKind, args: Vec<Type>, writable: bool, ) -> Type

Source

pub fn contains_write_permission(&self) -> bool

Whether a write permission appears anywhere in this type.

Source

pub fn contains_type_parameter(&self) -> bool

Whether a type parameter appears anywhere in this type.

Source

pub fn is_writable(&self) -> bool

Source

pub fn make_writable(self) -> Type

Source

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.

Source

pub fn shallow_demoted(&self) -> Type

This type with its own write permission removed, type arguments untouched.

Source

pub fn demotion_changes(&self) -> bool

Whether demoted would return a different type. Must mirror demoted.

Source

pub fn demoted(&self) -> Type

Source

pub fn function( params: Vec<FunctionParameter>, bounds: Vec<Bound>, return_type: Box<Type>, ) -> Type

Source

pub fn int() -> Type

Source

pub fn rune() -> Type

Source

pub fn string() -> Type

Source

pub fn bool() -> Type

Source

pub fn unit() -> Type

Source

pub fn test_context() -> Type

Source

pub fn is_test_context(&self) -> bool

Source§

impl Type

Source

pub fn uninferred() -> Self

Source

pub fn is_uninferred(&self) -> bool

Source

pub fn get_type_params(&self) -> Option<&[Type]>

Source

pub fn without_permissions(&self) -> Type

Source

pub fn map_children(&self, map: impl FnMut(&Type) -> Type) -> Type

Source

pub fn children(&self) -> TypeChildren<'_> ⓘ

Direct child types, for read-only walks. Excludes Function.bounds.

Source§

impl Type

Source

pub fn get_function_ret(&self) -> Option<&Type>

Source

pub fn is_stringer_signature(&self, peel: impl Fn(&Type) -> Type) -> bool

Source

pub fn is_equals_signature(&self, peel: impl Fn(&Type) -> Type) -> bool

Source

pub fn is_equals_bound_signature( &self, param_name: &str, peel: impl Fn(&Type) -> Type, ) -> bool

Source

pub fn has_name(&self, name: &str) -> bool

Source

pub fn get_qualified_id(&self) -> Option<&str>

Source

pub fn nominal_id(&self) -> Option<&Symbol>

Source

pub fn is_result(&self) -> bool

Source

pub fn is_option(&self) -> bool

Source

pub fn is_partial(&self) -> bool

Source

pub fn is_value_and_bool(&self) -> bool

Source

pub fn option_of(inner: Type) -> Type

Source

pub fn is_unit(&self) -> bool

Source

pub fn tuple_arity(&self) -> Option<usize>

Source

pub fn is_tuple(&self) -> bool

Source

pub fn is_function(&self) -> bool

Source

pub fn is_nominal(&self) -> bool

Source

pub fn is_type_parameter(&self) -> bool

Source

pub fn is_array(&self) -> bool

Source

pub fn tuple_elements(&self) -> Option<&[Type]>

Source

pub fn array_parts(&self) -> Option<(u64, &Type)>

Source

pub fn array_len(&self) -> Option<u64>

Source

pub fn as_import_namespace(&self) -> Option<&str>

Source

pub fn as_compound(&self) -> Option<(CompoundKind, &[Type])>

Source

pub fn is_native(&self, kind: CompoundKind) -> bool

Source

pub fn is_ref(&self) -> bool

Source

pub fn is_slice(&self) -> bool

Source

pub fn is_map(&self) -> bool

Source

pub fn is_channel(&self) -> bool

Source

pub fn is_receiver_placeholder(&self) -> bool

Source

pub fn is_unknown(&self) -> bool

Source

pub fn is_receiver(&self) -> bool

Source

pub fn is_variadic(&self) -> Option<Type>

Source

pub fn is_string(&self) -> bool

Source

pub fn as_simple(&self) -> Option<SimpleKind>

Source

pub fn is_simple(&self, kind: SimpleKind) -> bool

Source

pub fn is_boolean(&self) -> bool

Source

pub fn is_float(&self) -> bool

Source

pub fn is_variable(&self) -> bool

Source

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.

Source

pub fn is_numeric(&self) -> bool

Source

pub fn is_complex(&self) -> bool

Source

pub fn is_unsigned_int(&self) -> bool

Source

pub fn is_never(&self) -> bool

Source

pub fn is_error(&self) -> bool

Source

pub fn contains_error(&self) -> bool

Source

pub fn reported_error(&self) -> Option<ErrorReported>

Source

pub fn has_variables(&self) -> bool

Source

pub fn collect_variables(&self, out: &mut Vec<TypeVarId>)

Source

pub fn has_unbound_variables(&self) -> bool

Source

pub fn collect_unbound_variables(&self, out: &mut Vec<TypeVarId>)

Source

pub fn remove_found_type_names(&self, names: &mut FxHashSet<EcoString>)

Source§

impl Type

Source

pub fn display_name(&self) -> Option<DisplayName<'_>>

Source

pub fn namespace_name(&self) -> Option<&str>

Source

pub fn wraps(&self, is_wrapper: impl Fn(&Type) -> bool, inner: &Type) -> bool

Source

pub fn get_function_params(&self) -> Option<&[FunctionParameter]>

Source

pub fn param_count(&self) -> usize

Source

pub fn with_replaced_first_param(&self, new_first: &Type) -> Type

Source

pub fn get_bounds(&self) -> &[Bound]

Source

pub fn get_qualified_name(&self) -> Option<Symbol>

Source

pub fn inner(&self) -> Option<Type>

Source

pub fn ok_type(&self) -> Type

Source

pub fn err_type(&self) -> Type

Source§

impl Type

Source

pub fn as_function_type(&self) -> Option<&FunctionType>

Source

pub fn ref_depth(&self) -> usize

Source

pub fn strip_refs(&self) -> Type

Source

pub fn receiver_shape(&self) -> Type

Source

pub fn points_to_ref(&self) -> bool

Source

pub fn is_option_or_result(&self) -> bool

Source

pub fn tuple_or_type_arguments(&self) -> Vec<Type>

Source

pub fn is_prelude_error(&self) -> bool

Source

pub fn range_type(&self) -> Option<Type>

Source

pub fn with_receiver_placeholder(self) -> Type

Source

pub fn remove_vars(types: &[&Type]) -> (Vec<Type>, Vec<EcoString>)

Source

pub fn contains_type(&self, target: &Type) -> bool

Source§

impl Type

Trait Implementations§

Source§

impl Clone for Type

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Type

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Type

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Type

Source§

impl From<TypeKind> for Type

Source§

fn from(kind: TypeKind) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<Type> for TypeList

Source§

fn from_iter<I: IntoIterator<Item = Type>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl Hash for Type

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Type

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl Forget for Type

§

impl Freeze for Type
where *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
where Arc<Box<[Type]>>: Send, EcoVec<u8>: Send, Arc<FunctionType>: Send, RawVecInner: Send, BoxRaw<Type>: Send, Arc<Spelling>: Send,

§

impl Sync for Type
where Arc<Box<[Type]>>: Sync, EcoVec<u8>: Sync, Arc<FunctionType>: Sync, RawVecInner: Sync, BoxRaw<Type>: Sync, Arc<Spelling>: Sync,

§

impl Unpin for Type

§

impl UnsafeUnpin for Type

§

impl UnwindSafe for Type

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToEcoString for T
where T: Display + ?Sized,

Source§

fn to_eco_string(&self) -> EcoString

Converts the given value to an EcoString.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.