Struct rustc_middle::ty::sty::ProjectionTy[][src]

pub struct ProjectionTy<'tcx> {
    pub substs: SubstsRef<'tcx>,
    pub item_def_id: DefId,
}

Represents the projection of an associated type. In explicit UFCS form this would be written <T as Trait<..>>::N.

Fields

substs: SubstsRef<'tcx>

The parameters of the associated item.

item_def_id: DefId

The DefId of the TraitItem for the associated type N.

Note that this is not the DefId of the TraitRef containing this associated type, which is in tcx.associated_item(item_def_id).container.

Implementations

impl<'tcx> ProjectionTy<'tcx>[src]

pub fn trait_def_id(&self, tcx: TyCtxt<'tcx>) -> DefId[src]

pub fn trait_ref_and_own_substs(
    &self,
    tcx: TyCtxt<'tcx>
) -> (TraitRef<'tcx>, &'tcx [GenericArg<'tcx>])
[src]

Extracts the underlying trait reference and own substs from this projection. For example, if this is a projection of <T as StreamingIterator>::Item<'a>, then this function would return a T: Iterator trait reference and ['a] as the own substs

pub fn trait_ref(&self, tcx: TyCtxt<'tcx>) -> TraitRef<'tcx>[src]

Extracts the underlying trait reference from this projection. For example, if this is a projection of <T as Iterator>::Item, then this function would return a T: Iterator trait reference.

WARNING: This will drop the substs for generic associated types consider calling Self::trait_ref_and_own_substs to get those as well.

pub fn self_ty(&self) -> Ty<'tcx>[src]

Trait Implementations

impl<'tcx> Clone for ProjectionTy<'tcx>[src]

impl<'tcx> Copy for ProjectionTy<'tcx>[src]

impl<'tcx> Debug for ProjectionTy<'tcx>[src]

impl<'tcx, __D: TyDecoder<'tcx>> Decodable<__D> for ProjectionTy<'tcx>[src]

impl<'tcx> Display for ProjectionTy<'tcx>[src]

impl<'tcx, __E: TyEncoder<'tcx>> Encodable<__E> for ProjectionTy<'tcx>[src]

impl<'tcx> Eq for ProjectionTy<'tcx>[src]

impl<'tcx> Hash for ProjectionTy<'tcx>[src]

impl<'tcx, '__ctx> HashStable<StableHashingContext<'__ctx>> for ProjectionTy<'tcx>[src]

impl<'a, 'tcx> Lift<'tcx> for ProjectionTy<'a>[src]

type Lifted = ProjectionTy<'tcx>

impl<'tcx> Ord for ProjectionTy<'tcx>[src]

impl<'tcx> PartialEq<ProjectionTy<'tcx>> for ProjectionTy<'tcx>[src]

impl<'tcx> PartialOrd<ProjectionTy<'tcx>> for ProjectionTy<'tcx>[src]

impl<'tcx, P: PrettyPrinter<'tcx>> Print<'tcx, P> for ProjectionTy<'tcx>[src]

type Output = P

type Error = Error

impl<'tcx> Relate<'tcx> for ProjectionTy<'tcx>[src]

impl<'tcx> StructuralEq for ProjectionTy<'tcx>[src]

impl<'tcx> StructuralPartialEq for ProjectionTy<'tcx>[src]

impl<'tcx> TypeFoldable<'tcx> for ProjectionTy<'tcx>[src]

Auto Trait Implementations

impl<'tcx> !RefUnwindSafe for ProjectionTy<'tcx>

impl<'tcx> !Send for ProjectionTy<'tcx>

impl<'tcx> !Sync for ProjectionTy<'tcx>

impl<'tcx> Unpin for ProjectionTy<'tcx>

impl<'tcx> !UnwindSafe for ProjectionTy<'tcx>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<'tcx, T> ArenaAllocatable<'tcx, ()> for T where
    T: Copy
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> Captures<'a> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> MaybeResult<T> for T[src]

type Error = !

impl<'tcx, T> Subst<'tcx> for T where
    T: TypeFoldable<'tcx>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithConstness for T[src]