The derive
attribute allows certain traits to be automatically implemented for data structures. The reference gives the example:
#[derive(PartialEq, Clone)]
struct Foo<T> {
a: i32,
b: T
}
Is it possible to add your own derivable traits, or are these fixed by the compiler?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…