Generic Data Types

You can use generics to abstract over the concrete field type:

1. #[derive(Debug)]
2. struct Point<T> {
3. x: T,
4. y: T,
5. }

7. fn main() {
8. let integer = Point { x: 5, y: 10 };
9. let float = Point { x: 1.0, y: 4.0 };
10. println!("{integer:?} and {float:?}");
11. }