diff options
Diffstat (limited to 'exercises/14_generics/generics2.rs')
| -rw-r--r-- | exercises/14_generics/generics2.rs | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/exercises/14_generics/generics2.rs b/exercises/14_generics/generics2.rs index 074cd93..8908725 100644 --- a/exercises/14_generics/generics2.rs +++ b/exercises/14_generics/generics2.rs @@ -1,23 +1,20 @@ -// generics2.rs -// // This powerful wrapper provides the ability to store a positive integer value. -// Rewrite it using generics so that it supports wrapping ANY type. -// -// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a -// hint. - -// I AM NOT DONE - +// TODO: Rewrite it using a generic so that it supports wrapping ANY type. struct Wrapper { value: u32, } +// TODO: Adapt the struct's implementation to be generic over the wrapped value. impl Wrapper { - pub fn new(value: u32) -> Self { + fn new(value: u32) -> Self { Wrapper { value } } } +fn main() { + // You can optionally experiment here. +} + #[cfg(test)] mod tests { use super::*; |
