From 6f878dcf8f5dfd08ec70bafbdf8cfdf7c347710d Mon Sep 17 00:00:00 2001 From: Charisee Chiw Date: Mon, 13 Feb 2023 07:31:15 -0800 Subject: [PATCH] Speaker Notes for tuple-structs (#197) * Speaker Notes for tuple-structs * Update tuple-structs.md --- src/structs/tuple-structs.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/structs/tuple-structs.md b/src/structs/tuple-structs.md index 4ac7e07c..1ffc1a41 100644 --- a/src/structs/tuple-structs.md +++ b/src/structs/tuple-structs.md @@ -34,8 +34,10 @@ fn main() {
-Newtypes are a great way to encode additional information about the value in a primitive type, for example: +* Newtypes are a great way to encode additional information about the value in a primitive type, for example: * The number is measured in some units: `Newtons` in the example above. * The value passed some validation when it was created, so you no longer have to validate it again at every use: 'PhoneNumber(String)` or `OddNumber(u32)`. - +* Demonstrate how to add a `f64` value to a `Newtons` type by accessing the single field in the newtype. + * Rust generally doesn’t like inexplicit things, like automatic unwrapping or for instance using booleans as integers. + * Operator overloading is discussed on Day 3 (generics).