Closed
Description
Given
struct Point { x: int, y: int }
fn returns_point(...) -> Point { ... }
fn returns_tuple(...) -> (int, int) { ... }
it would be nice to be able to do things like
let a; let b;
(a, b) = returns_tuple(...);
let c; let d;
Point { x: c, y: d } = returns_point(...);
and not just in let
s, as we currently allow.
Perhaps even:
let my_point: Point;
(my_point.x, my_point.y) = returns_tuple(...);
(Most use cases would likely involve mut
variables; but those examples would be longer.)
Related issues from the rust
repo: rust-lang/rust#10174 rust-lang/rust#12138