Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Generic Pair

Create a generic struct Pair<A, B> with fields first: A and second: B. Derive Debug. Create a pair of a string and an integer, then print it.

Expected output:

text
Pair { first: "age", second: 25 }

Hints:

  • struct Pair<A, B> { first: A, second: B }
  • Use Pair { first: "age", second: 25 }
rust
fn main() {
}