Skip to content

Commit

Permalink
Unit-like structs doc: Improve code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorBreakfast committed Feb 28, 2017
1 parent e1cb9ba commit 3c5001f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/doc/book/src/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,10 @@ You can define a `struct` with no members at all:
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.
// Use the same notation when creating an instance.
let x = Electron {};
let y = Proton;
let z = Electron; // Error
```

Such a `struct` is called ‘unit-like’ because it resembles the empty
Expand Down

0 comments on commit 3c5001f

Please sign in to comment.