[−][src]Struct rustc_middle::ty::walk::TypeWalker

pub struct TypeWalker<'tcx> {
    stack: SmallVec<[GenericArg<'tcx>; 8]>,
    last_subtree: usize,
    visited: SsoHashSet<GenericArg<'tcx>>,
}

Fields

stack: SmallVec<[GenericArg<'tcx>; 8]>last_subtree: usizevisited: SsoHashSet<GenericArg<'tcx>>

Implementations

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

An iterator for walking the type tree.

It's very easy to produce a deeply nested type tree with a lot of identical subtrees. In order to work efficiently in this situation walker only visits each type once. It maintains a set of visited types and skips any types that are already there.

pub fn new(root: GenericArg<'tcx>) -> Self[src]

pub fn skip_current_subtree(&mut self)[src]

Skips the subtree corresponding to the last type returned by next().

Example: Imagine you are walking Foo<Bar<i32>, usize>.

let mut iter: TypeWalker = ...;
iter.next(); // yields Foo
iter.next(); // yields Bar<i32>
iter.skip_current_subtree(); // skips i32
iter.next(); // yields usize

Trait Implementations

impl<'tcx> Iterator for TypeWalker<'tcx>[src]

type Item = GenericArg<'tcx>

The type of the elements being iterated over.

Auto Trait Implementations

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

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

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

impl<'tcx> Unpin for TypeWalker<'tcx>

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[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<I> IntoIterator for I where
    I: Iterator, 
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

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

type Error = !

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]