From 0859cf22eff232fbe82035ea6b84c1e6dbfc2238 Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Wed, 23 Nov 2016 09:29:08 -0500 Subject: [PATCH] Use Literal formatting a bit less for the word "struct" In these cases, we're using it more as an English concept (that we've defined) and not a literal keyword. --- nostarch/chapter05.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nostarch/chapter05.md b/nostarch/chapter05.md index f81fed62e..097b6865c 100644 --- a/nostarch/chapter05.md +++ b/nostarch/chapter05.md @@ -61,7 +61,7 @@ wanted just this user’s email address, we can say `user1.email`. To understand when we might want to use structs, let’s write a program that calculates the area of a rectangle. We’ll start off with single variable -bindings, then refactor our program until we’re using `struct`s instead. +bindings, then refactor our program until we’re using structs instead. Let’s make a new binary project with Cargo called *rectangles* that will take the length and width of a rectangle specified in pixels and will calculate the @@ -154,8 +154,8 @@ in our code. ### Refactoring with Structs: Adding More Meaning -Here is where we bring in `struct`s. We can transform our tuple into a data -type with a name for the whole as well as names for the parts: +Here is where we bring in structs. We can transform our tuple into a data type +with a name for the whole as well as names for the parts: Filename: src/main.rs @@ -181,8 +181,8 @@ fn area(rectangle: &Rectangle) -> u32 { -Here we've defined a `struct` and given it the name `Rectangle`. Inside the -`{}` we defined the fields to be `length` and `width`, both of which have type +Here we’ve defined a struct and given it the name `Rectangle`. Inside the `{}` +we defined the fields to be `length` and `width`, both of which have type `u32`. Then in `main`, we create a particular instance of a `Rectangle` that has a length of 50 and a width of 30.