Summary
Automatically derive PartialEq for enums in generated types.rs
Lack of PartialEq limits account storage validation
Basic Example
// types.rs
/// Custom enum: Role
#[derive(Debug, BorshDeserialize, BorshSerialize, Clone, /* auto-derive here */ PartialEq)]
pub enum Role {
Admin,
User,
}
// test_fuzz.rs
let account = self
.trident
.get_account_with_type::<Account>(&address, 8)
.unwrap();
// The resolved issue is:
// binary operation `==` cannot be applied to type `types::Role`
// consider annotating `types::Role` with `#[derive(PartialEq)]`
assert!(account.role == Role::User);
Drawbacks
Complex enums based on fields which do not implement PartialEq would not allow this
Unresolved questions
No response
Implementation PR
No response
Reference Issues
No response
Summary
Automatically derive
PartialEqfor enums in generatedtypes.rsLack of
PartialEqlimits account storage validationBasic Example
Drawbacks
Complex enums based on fields which do not implement
PartialEqwould not allow thisUnresolved questions
No response
Implementation PR
No response
Reference Issues
No response