diff --git a/src/style.rs b/src/style.rs index 0ae3b007..62b0f352 100644 --- a/src/style.rs +++ b/src/style.rs @@ -396,6 +396,26 @@ impl ExtratorField { } } +impl PartialEq for ExtratorField +where + R::Type: PartialEq, +{ + fn eq(&self, other: &Self) -> bool { + self.get() == other.get() + } +} + +impl Eq for ExtratorField where R::Type: Eq {} + +impl std::hash::Hash for ExtratorField +where + R::Type: std::hash::Hash, +{ + fn hash(&self, state: &mut H) { + self.get().hash(state) + } +} + #[macro_export] macro_rules! prop { ($v:vis $name:ident: $ty:ty { $($options:tt)* } = $default:expr @@ -429,12 +449,13 @@ macro_rules! prop { #[macro_export] macro_rules! prop_extractor { ( - $vis:vis $name:ident { + $(#[$attrs:meta])* $vis:vis $name:ident { $($prop_vis:vis $prop:ident: $reader:ty),* $(,)? } ) => { #[derive(Debug, Clone)] + $(#[$attrs])? $vis struct $name { $( $prop_vis $prop: $crate::style::ExtratorField<$reader>,