TypeInfoDirectory

Struct TypeInfoDirectory 

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

A directory of Types associating them to TypeIds, used as part of the specification of a Context. There can be multiple Type::VecTypes with different TypeIds, but given argument and return TypeIds, this directory may only contain at most one TypeId with the corresponding Type::FuncType.

Implementations§

Source§

impl TypeInfoDirectory

Source

pub fn new() -> Self

Creates an empty TypeInfoDirectory.

Source

pub fn add(&mut self, info: Type) -> TypeId

Adds the given Type to this TypeInfoDirectory, and returns the TypeId that it was assigned.

Source

pub fn get_total_num_types(&self) -> usize

Gets the total number of types stored in this TypeInfoDirectory. Since TypeIds are allocated consecutively, it’s correct to use this as an iteration bound if you want to iterate over all TypeIds stored here.

Source

pub fn has_func_type(&self, arg_type_id: TypeId, ret_type_id: TypeId) -> bool

Returns true iff this TypeInfoDirectory has a registered TypeId for Type::FuncType(arg_type_id, ret_type_id).

Source

pub fn get_func_type_id( &self, arg_type_id: TypeId, ret_type_id: TypeId, ) -> TypeId

Assuming that there is a TypeId for a function from the given argument TypeId to the given return TypeId, yields the TypeId of the function type.

Source

pub fn get_type(&self, id: TypeId) -> Type

Gets the Type information stored for the given TypeId.

Source

pub fn get_application_type_ids(&self, id: TypeId) -> Vec<(TypeId, TypeId)>

Gets all (func_type_id, arg_type_id) pairs which may be applied to yield the given TypeId.

Source

pub fn get_ret_type_id(&self, func_type_id: TypeId) -> TypeId

Given the TypeId of a function type, yields the TypeId of the return type.

Source

pub fn is_vector_type(&self, id: TypeId) -> bool

Returns true iff the given TypeId points to a Type::VecType.

Source

pub fn get_arg_type_id(&self, func_type_id: TypeId) -> TypeId

Given the TypeId of a function type, yields the TypeId of the argument type.

Source

pub fn get_dimension(&self, vec_type_id: TypeId) -> usize

Assuming that the given TypeId points to a Type::VecType, yields the declared number of dimensions for that type’s base space.

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> 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V