show both forms of empty struct declaration

This commit is contained in:
Alex Burka 2016-07-05 13:46:06 -04:00 committed by GitHub
parent 56f24d7c19
commit 74e96299a2

View File

@ -234,9 +234,12 @@ rather than positions.
You can define a `struct` with no members at all:
```rust
struct Electron {}
struct Electron {} // use empty braces...
struct Proton; // ...or just a semicolon
// whether you declared the struct with braces or not, do the same when creating one
let x = Electron {};
let y = Proton;
```
Such a `struct` is called unit-like because it resembles the empty