Skip to main content

PrimitiveExt

Trait PrimitiveExt 

Source
pub trait PrimitiveExt {
    // Required methods
    fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>;
    fn to_int_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>;
}

Required Methods§

Source

fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>

Source

fn to_int_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>

Return an integer type matching this primitive. Useful in particular when dealing with enum discriminants.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl PrimitiveExt for Primitive

Source§

fn to_int_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>

Return an integer type matching this primitive. Useful in particular when dealing with enum discriminants.

Source§

fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx>

Implementors§