diff --git a/plugins/diopser/src/lib.rs b/plugins/diopser/src/lib.rs index 777a8c3b..aa4ead84 100644 --- a/plugins/diopser/src/lib.rs +++ b/plugins/diopser/src/lib.rs @@ -201,7 +201,7 @@ impl DiopserParams { } } -#[derive(Enum, Debug)] +#[derive(Enum, Debug, PartialEq)] enum SpreadStyle { Octaves, Linear, diff --git a/src/param.rs b/src/param.rs index 8174c469..5c4e556a 100644 --- a/src/param.rs +++ b/src/param.rs @@ -22,7 +22,7 @@ pub use integer::IntParam; /// Describes a single parameter of any type. pub trait Param: Display { /// The plain parameter type. - type Plain; + type Plain: PartialEq; /// Get the human readable name for this parameter. fn name(&self) -> &'static str; diff --git a/src/param/enums.rs b/src/param/enums.rs index 73e18610..d673c4f0 100644 --- a/src/param/enums.rs +++ b/src/param/enums.rs @@ -46,7 +46,7 @@ pub trait Enum { /// An [`IntParam`]-backed categorical parameter that allows convenient conversion to and from a /// simple enum. This enum must derive the re-exported [Enum] trait. Check the trait's documentation /// for more information on how this works. -pub struct EnumParam { +pub struct EnumParam { /// A type-erased version of this parameter so the wrapper can do its thing without needing to /// know about `T`. inner: EnumParamInner, @@ -65,7 +65,7 @@ pub struct EnumParamInner { variants: &'static [&'static str], } -impl Default for EnumParam { +impl Default for EnumParam { fn default() -> Self { let variants = T::variants(); @@ -86,7 +86,7 @@ impl Default for EnumParam { } } -impl Display for EnumParam { +impl Display for EnumParam { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.inner.fmt(f) } @@ -98,7 +98,7 @@ impl Display for EnumParamInner { } } -impl Param for EnumParam { +impl Param for EnumParam { type Plain = T; fn name(&self) -> &'static str { @@ -237,7 +237,7 @@ impl Param for EnumParamInner { } } -impl EnumParam { +impl EnumParam { /// Build a new [Self]. Use the other associated functions to modify the behavior of the /// parameter. pub fn new(name: &'static str, default: T) -> Self {