Skip to content

Commit

Permalink
Derive Hash for EnumOrUnknown
Browse files Browse the repository at this point in the history
Since EnumOrUnknown does not have a protoc insertion point, additional
derives cannot be added via the api. At the same time, EnumOrUnknown are
simple values that are likely to be stored in a hash collection, such as
a map or set. This single word commit adds the derive for the Hash trait
to EnumOrUnknown.
  • Loading branch information
Tyler Herman-Hoyer committed Jul 3, 2024
1 parent 0e6f3ff commit 9935a3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion protobuf/src/enum_or_unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::Enum;
use crate::EnumFull;

/// Protobuf enums with possibly unknown values are preserved in this struct.
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone)]
#[derive(Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Hash)]
#[repr(transparent)]
// This should be <E: ProtobufEnum> when it no longer prevents using const fns.
pub struct EnumOrUnknown<E> {
Expand Down

0 comments on commit 9935a3a

Please sign in to comment.