pub struct TyCtx { /* private fields */ }Expand description
When type checking a super::expr::RelExpr, types are stored in a typing context TyCtx. It will then hold references, in the form of TyIds, to the types defined in the TyCtx.
Implementations§
Source§impl TyCtx
impl TyCtx
Sourcepub fn bool(&self) -> TypeWithCtx<'_>
pub fn bool(&self) -> TypeWithCtx<'_>
Return a wrapped Type::BOOL
Sourcepub fn i8(&self) -> TypeWithCtx<'_>
pub fn i8(&self) -> TypeWithCtx<'_>
Return a wrapped Type::I8
Sourcepub fn u8(&self) -> TypeWithCtx<'_>
pub fn u8(&self) -> TypeWithCtx<'_>
Return a wrapped Type::U8
Sourcepub fn i16(&self) -> TypeWithCtx<'_>
pub fn i16(&self) -> TypeWithCtx<'_>
Return a wrapped Type::I16
Sourcepub fn u16(&self) -> TypeWithCtx<'_>
pub fn u16(&self) -> TypeWithCtx<'_>
Return a wrapped Type::U16
Sourcepub fn i32(&self) -> TypeWithCtx<'_>
pub fn i32(&self) -> TypeWithCtx<'_>
Return a wrapped Type::I32
Sourcepub fn u32(&self) -> TypeWithCtx<'_>
pub fn u32(&self) -> TypeWithCtx<'_>
Return a wrapped Type::U32
Sourcepub fn i64(&self) -> TypeWithCtx<'_>
pub fn i64(&self) -> TypeWithCtx<'_>
Return a wrapped Type::I64
Sourcepub fn u64(&self) -> TypeWithCtx<'_>
pub fn u64(&self) -> TypeWithCtx<'_>
Return a wrapped Type::U64
Sourcepub fn i128(&self) -> TypeWithCtx<'_>
pub fn i128(&self) -> TypeWithCtx<'_>
Return a wrapped Type::I128
Sourcepub fn u128(&self) -> TypeWithCtx<'_>
pub fn u128(&self) -> TypeWithCtx<'_>
Return a wrapped Type::U128
Sourcepub fn i256(&self) -> TypeWithCtx<'_>
pub fn i256(&self) -> TypeWithCtx<'_>
Return a wrapped Type::I256
Sourcepub fn u256(&self) -> TypeWithCtx<'_>
pub fn u256(&self) -> TypeWithCtx<'_>
Return a wrapped Type::U256
Sourcepub fn f32(&self) -> TypeWithCtx<'_>
pub fn f32(&self) -> TypeWithCtx<'_>
Return a wrapped Type::F32
Sourcepub fn f64(&self) -> TypeWithCtx<'_>
pub fn f64(&self) -> TypeWithCtx<'_>
Return a wrapped Type::F64
Sourcepub fn str(&self) -> TypeWithCtx<'_>
pub fn str(&self) -> TypeWithCtx<'_>
Return a wrapped Type::STR
Sourcepub fn bytes(&self) -> TypeWithCtx<'_>
pub fn bytes(&self) -> TypeWithCtx<'_>
Return a wrapped AlgebraicType::bytes()
Sourcepub fn ident(&self) -> TypeWithCtx<'_>
pub fn ident(&self) -> TypeWithCtx<'_>
Return a wrapped AlgebraicType::identity()
Sourcepub fn try_resolve(&self, id: TyId) -> Result<TypeWithCtx<'_>, InvalidTypeId>
pub fn try_resolve(&self, id: TyId) -> Result<TypeWithCtx<'_>, InvalidTypeId>
Try to resolve an id to its Type. Return a resolution error if not found.
Sourcepub fn add_algebraic_type(&mut self, ty: &AlgebraicType) -> TyId
pub fn add_algebraic_type(&mut self, ty: &AlgebraicType) -> TyId
Add an AlgebraicType to the context and return a TyId for it. The TyId is not guaranteed to be unique to the type. However for primitive types it will be.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TyCtx
impl RefUnwindSafe for TyCtx
impl Send for TyCtx
impl Sync for TyCtx
impl Unpin for TyCtx
impl UnwindSafe for TyCtx
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more