mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-07 03:09:19 +00:00
Refactor Wrapper struct to use generics
This commit is contained in:
parent
344f62c9d3
commit
7e523787e1
@ -6,14 +6,12 @@
|
|||||||
// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a
|
// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a
|
||||||
// hint.
|
// hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
struct Wrapper<T> {
|
||||||
|
value: T,
|
||||||
struct Wrapper {
|
|
||||||
value: u32,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Wrapper {
|
impl<T> Wrapper<T> {
|
||||||
pub fn new(value: u32) -> Self {
|
pub fn new(value: T) -> Self {
|
||||||
Wrapper { value }
|
Wrapper { value }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user