Skip to main content

Types

Struct Types 

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

Implementations§

Source§

impl Types

Source

pub fn analyze(&mut self, resolve: &Resolve)

Source

pub fn collect_equal_types( &mut self, resolve: &Resolve, may_alias_another_type: &dyn Fn(TypeId) -> bool, )

Populates the return value of Types::get_representative_type with the resolve passed in.

The may_alias_another_type closure is used to determine whether the language’s definition of the provided TypeId might possibly alias some other type in a language. This is a language-specific deduction which can also be affected by options to a binding generator. If a type can’t be aliased by anything else then it can’t be considered equal to anything else. Note that in this situations other types may still be equal to it, such as aliased types at the WIT level (e.g. type foo = some-record).

Source

pub fn get(&self, id: TypeId) -> TypeInfo

Source

pub fn type_id_info(&mut self, resolve: &Resolve, ty: TypeId) -> TypeInfo

Source

pub fn type_info(&mut self, resolve: &Resolve, ty: &Type) -> TypeInfo

Source

pub fn get_representative_type(&mut self, id: TypeId) -> TypeId

Trait Implementations§

Source§

impl Default for Types

Source§

fn default() -> Types

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

Auto Trait Implementations§

§

impl Freeze for Types

§

impl RefUnwindSafe for Types

§

impl Send for Types

§

impl Sync for Types

§

impl Unpin for Types

§

impl UnwindSafe for Types

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.