pub struct Closure<'tcx> {
fn_trait_args: [Ty<'tcx>; 2],
kind: ClosureKind,
param_env: ParamEnv<'tcx>,
sig: PolyFnSig<'tcx>,
tupled_inputs: Ty<'tcx>,
upvar_tys: Vec<Ty<'tcx>>,
inline: InlineAttr,
}Expand description
A closure, coroutine, or coroutine-closure.
Fields§
§fn_trait_args: [Ty<'tcx>; 2][closure_ty, tupled_args_ty]: the args of the Fn* traits for this closure.
The signature’s bound regions are liberated in these types, and the extra_regions may be
mentioned as well.
kind: ClosureKind§param_env: ParamEnv<'tcx>The closure inherits its ordinary generics from its parent. It does have type parameters,
used by rustc for inference purposes. These are hidden from the ParamEnv. Any erased
lifetimes found in these inferred generics are replaced with placeholder regions, stored in
extra_early_regions.
sig: PolyFnSig<'tcx>§tupled_inputs: Ty<'tcx>The inputs of sig, tupled as the Fn* traits take them, e.g. (A, B, C).
upvar_tys: Vec<Ty<'tcx>>The captured variables, which together form the closure’s state.
inline: InlineAttrImplementations§
Source§impl<'tcx> Closure<'tcx>
impl<'tcx> Closure<'tcx>
pub fn param_env(&self) -> &ParamEnv<'tcx>
pub fn kind(&self) -> &ClosureKind
pub fn sig(&self) -> &PolyFnSig<'tcx>
Sourcepub fn tupled_inputs<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Ty<'tcx>
pub fn tupled_inputs<S: UnderOwnerState<'tcx>>(&self, s: &S) -> Ty<'tcx>
The inputs of sig, tupled as the Fn* traits take them, e.g. (A, B, C).
s must have the closure as owner.
pub fn upvar_tys(&self) -> &[Ty<'tcx>]
pub fn inline(&self) -> &InlineAttr
Trait Implementations§
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for Closure<'tcx>
impl<'tcx> !UnwindSafe for Closure<'tcx>
impl<'tcx> DynSend for Closure<'tcx>
impl<'tcx> DynSync for Closure<'tcx>
impl<'tcx> Forget for Closure<'tcx>
impl<'tcx> Freeze for Closure<'tcx>
impl<'tcx> Move for Closure<'tcx>
impl<'tcx> Send for Closure<'tcx>
impl<'tcx> Sync for Closure<'tcx>
impl<'tcx> Unpin for Closure<'tcx>
impl<'tcx> UnsafeUnpin for Closure<'tcx>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more