Struct SubtypeChecker

Source
pub struct SubtypeChecker<'a> { /* private fields */ }
Expand description

Implements a subtype checker.

Subtype checking is used to type check instantiation arguments.

Implementations§

Source§

impl<'a> SubtypeChecker<'a>

Source

pub fn new(cache: &'a mut HashSet<(ItemKind, ItemKind)>) -> Self

Creates a new subtype checker with the given cache.

Source

pub fn is_subtype( &mut self, a: ItemKind, at: &Types, b: ItemKind, bt: &Types, ) -> Result<()>

Checks if a is a subtype of b.

Source

pub fn invert(&mut self) -> SubtypeCheck

Inverts the current subtype check being performed.

Returns the previous subtype check.

Source

pub fn revert(&mut self)

Reverts to the previous check kind.

Auto Trait Implementations§

§

impl<'a> Freeze for SubtypeChecker<'a>

§

impl<'a> RefUnwindSafe for SubtypeChecker<'a>

§

impl<'a> Send for SubtypeChecker<'a>

§

impl<'a> Sync for SubtypeChecker<'a>

§

impl<'a> Unpin for SubtypeChecker<'a>

§

impl<'a> !UnwindSafe for SubtypeChecker<'a>

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.