diff options
| author | Alex Burka <durka42+github@gmail.com> | 2016-07-05 13:46:06 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-05 13:46:06 -0400 |
| commit | 74e96299a22ef1629d7ea8268815fc2b82c7e194 (patch) | |
| tree | 446d283ca9f7b4ab292f5946413d74ac0b6d0b02 /src/doc | |
| parent | 56f24d7c193da3b972994e24b86e1fd63e1e8c9e (diff) | |
| download | rust-74e96299a22ef1629d7ea8268815fc2b82c7e194.tar.gz rust-74e96299a22ef1629d7ea8268815fc2b82c7e194.zip | |
show both forms of empty struct declaration
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/book/structs.md | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/doc/book/structs.md b/src/doc/book/structs.md index 1fb74e33a62..328db25b819 100644 --- a/src/doc/book/structs.md +++ b/src/doc/book/structs.md @@ -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 |
