From de77d1b223399c828793959d2d24cd7ac03cffe8 Mon Sep 17 00:00:00 2001 From: Justin Kelz Date: Sun, 1 May 2022 08:33:02 -0700 Subject: [PATCH] Added comments to generics2 --- exercises/generics/generics2.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/exercises/generics/generics2.rs b/exercises/generics/generics2.rs index 1501529c..77166b35 100644 --- a/exercises/generics/generics2.rs +++ b/exercises/generics/generics2.rs @@ -3,13 +3,13 @@ // Execute `rustlings hint generics2` for hints! -// I AM NOT DONE +// Looking at the diff of this file and my changes should give enough exposition. -struct Wrapper { - value: u32, +struct Wrapper { // We modify this to accept any type T, and then we'll implement it down below + value: T, } -impl Wrapper { +impl Wrapper { // so here you'll notice that I provide impl with a type, as I also specify a type for the wrapper, this allows us to handle the u32 case. pub fn new(value: u32) -> Self { Wrapper { value } }