CaptureBy in rustc_ast::ast - Rust (original) (raw)
pub enum CaptureBy {
Value {
move_kw: Span,
},
Ref,
Use {
use_kw: Span,
},
}
Expand description
A capture clause used in closures and async
blocks.
move |x| y + x
.
Fields
The span of the move
keyword.
move
or use
keywords were not specified.
use |x| y + x
.
Note that if you have a regular closure like || x.use
, this will not result in a Use
capture. Instead, the ExprUseVisitor
will look at the type of x
and treat x.use
as either a copy/clone/move as appropriate.
Fields
The span of the use
keyword.
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: 12 bytes
Size for each variant:
Value
: 8 bytesRef
: 0 bytesUse
: 8 bytes