From 7f43c5782cb252ba800d44a17b5c184aedffb6c7 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Sat, 18 Apr 2015 15:54:33 -0400 Subject: [PATCH] TRPL editing: structs --- src/doc/trpl/structs.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/trpl/structs.md b/src/doc/trpl/structs.md index 83d5a15bc2c..ff249d6043c 100644 --- a/src/doc/trpl/structs.md +++ b/src/doc/trpl/structs.md @@ -1,6 +1,6 @@ % Structs -Structs are a way of creating more complex datatypes. For example, if we were +Structs are a way of creating more complex data types. For example, if we were doing calculations involving coordinates in 2D space, we would need both an `x` and a `y` value: @@ -24,12 +24,12 @@ fn main() { } ``` -There’s a lot going on here, so let’s break it down. We declare a struct with -the `struct` keyword, and then with a name. By convention, structs begin with a -capital letter and are also camel cased: `PointInSpace`, not `Point_In_Space`. +There’s a lot going on here, so let’s break it down. We declare a `struct` with +the `struct` keyword, and then with a name. By convention, `struct`s begin with +a capital letter and are camel cased: `PointInSpace`, not `Point_In_Space`. We can create an instance of our struct via `let`, as usual, but we use a `key: -value` style syntax to set each field. The order doesn't need to be the same as +value` style syntax to set each field. The order doesn’t need to be the same as in the original declaration. Finally, because fields have names, we can access the field through dot