Struct TypeCache

Source
pub struct TypeCache { /* private fields */ }
Expand description

Type cache for interning and deduplicating types in the system

Implementations§

Source§

impl TypeCache

Source

pub fn new() -> Self

Create a new empty type cache

Source

pub const fn type_id_to_type(&self) -> &SeqMap<TypeId, Rc<Type>>

Source

pub const fn compatible_cache(&self) -> &SeqMap<(TypeId, TypeId), bool>

Source

pub fn get_by_id(&self, id: TypeId) -> Option<Rc<Type>>

Get a type by its ID

Source

pub fn compatible_with(&mut self, a: &Type, b: &Type) -> bool

Check if two types are compatible

Source

pub fn clear_compatibility_cache(&mut self)

Clear the compatibility cache

Source

pub fn never(&mut self) -> Rc<Type>

Source

pub fn byte(&mut self) -> Rc<Type>

Source

pub fn short(&mut self) -> Rc<Type>

Source

pub fn int(&mut self) -> Rc<Type>

Source

pub fn codepoint(&mut self) -> Rc<Type>

Source

pub fn float(&mut self) -> Rc<Type>

Source

pub fn bool(&mut self) -> Rc<Type>

Source

pub fn unit(&mut self) -> Rc<Type>

Source

pub fn optional(&mut self, inner_type: &Rc<Type>) -> Rc<Type>

Source

pub fn tuple(&mut self, element_types: Vec<Rc<Type>>) -> Rc<Type>

Source

pub fn string_storage(&mut self, capacity: usize) -> Rc<Type>

Source

pub fn string(&mut self) -> Rc<Type>

Source

pub fn ptr(&mut self, inner_type: Rc<Type>) -> Rc<Type>

Source

pub fn vec_storage( &mut self, element_type: &Rc<Type>, capacity: usize, ) -> Rc<Type>

Source

pub fn sparse_storage( &mut self, element_type: &Rc<Type>, capacity: usize, ) -> Rc<Type>

Source

pub fn queue_storage( &mut self, element_type: &Rc<Type>, capacity: usize, ) -> Rc<Type>

Source

pub fn stack_storage( &mut self, element_type: &Rc<Type>, capacity: usize, ) -> Rc<Type>

Source

pub fn map_storage( &mut self, key_type: &Rc<Type>, value_type: &Rc<Type>, capacity: usize, ) -> Rc<Type>

Source

pub fn grid_storage( &mut self, element_type: &Rc<Type>, rows: usize, cols: usize, ) -> Rc<Type>

Source

pub fn fixed_array(&mut self, element_type: &Rc<Type>, size: usize) -> Rc<Type>

Source

pub fn slice_view(&mut self, element_type: &Rc<Type>) -> Rc<Type>

Source

pub fn sparse_view(&mut self, element_type: &Rc<Type>) -> Rc<Type>

Source

pub fn queue_view(&mut self, element_type: &Rc<Type>) -> Rc<Type>

Source

pub fn stack_view(&mut self, element_type: &Rc<Type>) -> Rc<Type>

Source

pub fn any(&mut self) -> Rc<Type>

Source

pub fn dynamic_vec_view(&mut self, element_type: &Rc<Type>) -> Rc<Type>

Source

pub fn dynamic_map_view( &mut self, key_type: &Rc<Type>, value_type: &Rc<Type>, ) -> Rc<Type>

Source

pub fn grid_view(&mut self, element_type: &Rc<Type>) -> Rc<Type>

Source

pub fn anonymous_struct(&mut self, anon_struct: AnonymousStructType) -> Rc<Type>

Create an anonymous struct type

Source

pub fn range(&mut self, range_struct_ref: Rc<Type>) -> Rc<Type>

Source

pub fn range_int(&mut self) -> Rc<Type>

Source

pub fn named_struct(&mut self, named_struct: NamedStructType) -> Rc<Type>

Source

pub fn enum_type(&mut self, enum_type: EnumType) -> Rc<Type>

Source

pub fn function(&mut self, signature: Signature) -> Rc<Type>

Trait Implementations§

Source§

impl Clone for TypeCache

Source§

fn clone(&self) -> TypeCache

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for TypeCache

Source§

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

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

impl Default for TypeCache

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.