rustc_utils::hir::ty

Trait TyExt

Source
pub trait TyExt<'tcx> {
    // Required methods
    fn inner_regions(self) -> impl Iterator<Item = Region<'tcx>>;
    fn does_implement_trait(
        self,
        tcx: TyCtxt<'tcx>,
        param_env: ParamEnv<'tcx>,
        trait_def_id: DefId,
    ) -> bool;
    fn is_copyable(self, tcx: TyCtxt<'tcx>, typing_env: TypingEnv<'tcx>) -> bool;
}
Expand description

Extension trait for Ty.

Required Methods§

Source

fn inner_regions(self) -> impl Iterator<Item = Region<'tcx>>

Returns an iterator over the regions appearing within a type.

Source

fn does_implement_trait( self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, trait_def_id: DefId, ) -> bool

Returns true if a type implements a given trait.

Source

fn is_copyable(self, tcx: TyCtxt<'tcx>, typing_env: TypingEnv<'tcx>) -> bool

Returns true if a type implements Copy.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'tcx> TyExt<'tcx> for Ty<'tcx>

Source§

fn inner_regions(self) -> impl Iterator<Item = Region<'tcx>>

Source§

fn does_implement_trait( self, tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, trait_def_id: DefId, ) -> bool

Source§

fn is_copyable(self, tcx: TyCtxt<'tcx>, typing_env: TypingEnv<'tcx>) -> bool

Implementors§