Skip to content

Commit

Permalink
generics
Browse files Browse the repository at this point in the history
  • Loading branch information
Matrx123 committed Apr 12, 2024
1 parent 0ef1a42 commit 113baf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions exercises/14_generics/generics1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
// 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");
}
8 changes: 4 additions & 4 deletions exercises/14_generics/generics2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,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 }
}
}
Expand Down

0 comments on commit 113baf4

Please sign in to comment.