mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-28 00:06:29 +00:00
fix: update generics2 closes #362
This commit is contained in:
parent
c9e4f2cfb4
commit
964c974a02
1 changed files with 3 additions and 5 deletions
|
@ -2,11 +2,11 @@
|
||||||
// Rewrite it using generics so that it supports wrapping ANY type.
|
// Rewrite it using generics so that it supports wrapping ANY type.
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
struct Wrapper<u32> {
|
struct Wrapper {
|
||||||
value: u32
|
value: u32
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<u32> Wrapper<u32> {
|
impl Wrapper {
|
||||||
pub fn new(value: u32) -> Self {
|
pub fn new(value: u32) -> Self {
|
||||||
Wrapper { value }
|
Wrapper { value }
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,6 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn store_str_in_wrapper() {
|
fn store_str_in_wrapper() {
|
||||||
// TODO: Delete this assert and uncomment the one below once you have finished the exercise.
|
assert_eq!(Wrapper::new("Foo").value, "Foo");
|
||||||
assert!(false);
|
|
||||||
// assert_eq!(Wrapper::new("Foo").value, "Foo");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue