Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Generic Wrapper

Create a generic struct Wrapper<T> with a field value: T. Derive Debug. Create a wrapper holding an integer and another holding a string, then print both.

Expected output:

text
Wrapper { value: 99 }
Wrapper { value: "Rust" }

Hints:

  • #[derive(Debug)] above the struct
  • struct Wrapper<T> { value: T }
  • Print with {:?}
rust
fn main() {
}