|
|
|
|
|
by masklinn
1243 days ago
|
|
Conveniently in Rust because a block is an expression it lets you "convert" a statement (or sequence thereof) into an expression. To be used sparingly, but very useful when it applies e.g. in the precise capture clause pattern, or for non-trivial object initialisation (as Rust doesn't have many literals or literal-ish macros). |
|
In general: {expression} turns a place expression into a value expression, i.e. forcing the place to be moved from.