-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Labels
questionFurther information is requestedFurther information is requested
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested