feat: complete generics

This commit is contained in:
Yedidya Rashi 2023-04-09 20:13:36 +03:00
parent 6c8897f30c
commit 54971f6aff
2 changed files with 5 additions and 7 deletions

View File

@ -3,9 +3,7 @@
// Execute `rustlings hint generics1` or use the `hint` watch subcommand for a hint. // Execute `rustlings hint generics1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
fn main() { fn main() {
let mut shopping_list: Vec<?> = Vec::new(); let mut shopping_list: Vec<&str> = Vec::new();
shopping_list.push("milk"); shopping_list.push("milk");
} }

View File

@ -5,12 +5,12 @@
// I AM NOT DONE // I AM NOT DONE
struct Wrapper { struct Wrapper<T> {
value: u32, value: T,
} }
impl Wrapper { impl<T> Wrapper<T> {
pub fn new(value: u32) -> Self { pub fn new(value: T) -> Self {
Wrapper { value } Wrapper { value }
} }
} }