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.
// I AM NOT DONE
fn main() {
let mut shopping_list: Vec<?> = Vec::new();
let mut shopping_list: Vec<&str> = Vec::new();
shopping_list.push("milk");
}

View File

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