From afbbb0de4aefcbb6f49f5cd5a83e29f38c9f54ec Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Thu, 21 Jul 2016 21:52:15 -0400 Subject: [PATCH] Cut discussion of unit structs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit es-o-ter-ic 👏👏, 👏👏👏 --- src/ch05-00-structs.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/ch05-00-structs.md b/src/ch05-00-structs.md index 37edf4d..db61340 100644 --- a/src/ch05-00-structs.md +++ b/src/ch05-00-structs.md @@ -158,17 +158,10 @@ struct NAME { ``` The `NAME: TYPE` bit is called a ‘field’, and we can have as many or as few of -them as you’d like. If you have none of them, drop the `{}`s: +them as we’d like. -```rust -struct Foo; -``` - -`struct`s with no fields are called ‘unit structs’, and are used in certain -advanced situations. We will just ignore them for now. - -You can access the field of a struct in the same way you access an element of -a tuple, except you use its name: +We can access the field of a struct in the same way we access an element of +a tuple, except we use its name: ```rust,ignore let p1 = (0.0, 5.0);