Refactor Wrapper struct to use generics

This commit is contained in:
Rock070 2024-01-02 23:47:45 +08:00
parent 344f62c9d3
commit 7e523787e1

View File

@ -6,14 +6,12 @@
// Execute `rustlings hint generics2` or use the `hint` watch subcommand for a
// hint.
// 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 }
}
}