Rust Learning Note: Generics and Traits
This blog is a summay of Chapter 2.8 of Rust Course (course.rs)
Generics
Generics can be used in structs, enumerators, and methods, as shown in the example below:
1 Using generics in structs:
struct Point<T> {
x: T,
y: T
}
fn main() {
le...
raine-yang.com7 min read