mirror of
https://github.com/rust-lang-cn/book-cn.git
synced 2025-02-02 15:28:40 +08:00
Merge pull request #52 from clemensw/structs_compare_to_tuples
Example Point changes coordinates.
This commit is contained in:
commit
5cd39dadb6
@ -143,7 +143,7 @@ struct Point {
|
||||
y: f64,
|
||||
}
|
||||
|
||||
let p1 = Point { x: 0.0, y: 0.0 };
|
||||
let p1 = Point { x: 0.0, y: 5.0 };
|
||||
```
|
||||
|
||||
Here’s what declaring a `struct` looks like:
|
||||
@ -176,7 +176,7 @@ struct Point {
|
||||
y: f64,
|
||||
}
|
||||
|
||||
let p1 = Point { x: 0.0, y: 0.0 };
|
||||
let p1 = Point { x: 0.0, y: 5.0 };
|
||||
let x = p1.x;
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user