pub struct GeneratorSubsts<'tcx> {
    pub substs: SubstsRef<'tcx>,
}
Expand description

Similar to ClosureSubsts; see the above documentation for more.

Fields

substs: SubstsRef<'tcx>

Implementations

Construct GeneratorSubsts from GeneratorSubstsParts, containing Substs for the generator parent, alongside additional generator-specific components.

Divides the generator substs into their respective components. The ordering assumed here must match that used by GeneratorSubsts::new above.

Returns true only if enough of the synthetic types are known to allow using all of the methods on GeneratorSubsts without panicking.

Used primarily by ty::print::pretty to be able to handle generator types that haven’t had their synthetic types substituted in.

Returns the substitutions of the generator’s parent.

This describes the types that can be contained in a generator. It will be a type variable initially and unified in the last stages of typeck of a body. It contains a tuple of all the types that could end up on a generator frame. The state transformation MIR pass may only produce layouts which mention types in this tuple. Upvars are not counted here.

Returns an iterator over the list of types of captured paths by the generator. In case there was a type error in figuring out the types of the captured path, an empty iterator is returned.

Returns the tuple type representing the upvars for this generator.

Returns the type representing the resume type of the generator.

Returns the type representing the yield type of the generator.

Returns the type representing the return type of the generator.

Returns the “generator signature”, which consists of its yield and return types.

N.B., some bits of the code prefers to see this wrapped in a binder, but it never contains bound regions. Probably this function should be removed.

Returns the “generator signature”, which consists of its resume, yield and return types.

Generator has not been resumed yet.

Generator has returned or is completed.

Generator has been poisoned.

The valid variant indices of this generator.

The discriminant for the given variant. Panics if the variant_index is out of range.

The set of all discriminants for the generator, enumerated with their variant indices.

Calls f with a reference to the name of the enumerator for the given variant v.

The type of the state discriminant used in the generator type.

This returns the types of the MIR locals which had to be stored across suspension points. It is calculated in rustc_mir_transform::generator::StateTransform. All the types here must be in the tuple in GeneratorInterior.

The locals are grouped by their variant number. Note that some locals may be repeated in multiple variants.

This is the types of the fields of a generator which are not stored in a variant.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
The entry point for folding. To fold a value t with a folder f call: t.try_fold_with(f). Read more
A convenient alternative to try_fold_with for use with infallible folders. Do not override this method, to ensure coherence with try_fold_with. Read more
The entry point for visiting. To visit a value t with a visitor v call: t.visit_with(v). Read more
Returns true if self has any late-bound regions that are either bound by binder or bound by some binder outside of binder. If binder is ty::INNERMOST, this indicates whether there are any late-bound regions that appear free. Read more
Returns true if this self has any regions that escape binder (and hence are not bound by it). Read more
“Free” regions in this context means that it has any region that is not (a) erased or (b) late-bound. Read more
True if there are any un-erased free regions.
Indicates whether this value references only ‘global’ generic parameters that are the same regardless of what fn we are in. This is used for caching. Read more
True if there are any late-bound regions
Indicates whether this value still has parameters/placeholders/inference variables which could be replaced later, in a way that would change the results of impl specialization. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.

Layout

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes