-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
Let's consider the struct
struct List {
name: String,
items: RefCell<Vec<Item>>,
}
Let's consider we need to compare two instances of List. We cannot use #[derive]
to implement comparison, because RefCell
has no impl for comparison. If we want to compare with name
field we must manually implement all required traits.
I suggest #[exclude_from_comparison]
attribute.
If I had the #[exclude_from_comparison]
attribute, then I will write
#[derive(PartialEq)]
#[derive(Eq)]
#[derive(PartialOrd)]
#[derive(Ord)]
struct List {
name: String,
#[exclude_from_comparison]
items: RefCell<Vec<Item>>,
}
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.