mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 14:42:30 +00:00
prop: implement InvalidProperty with Default
This commit is contained in:
@@ -32,7 +32,7 @@ impl<T: Serialize + for<'de> Deserialize<'de>> ResourceType for T {}
|
||||
|
||||
pub trait Resource: Clone + 'static {
|
||||
type PropName: ResourcePropName;
|
||||
type Prop: ResourceProp + From<CommonPropertiesProp<Self::ResourceType>>;
|
||||
type Prop: ResourceProp + From<CommonPropertiesProp<Self::ResourceType>> + PartialEq;
|
||||
type Error: ResponseError + From<crate::Error>;
|
||||
type PrincipalResource: Resource;
|
||||
type ResourceType: Default + Serialize + for<'de> Deserialize<'de>;
|
||||
@@ -188,6 +188,12 @@ pub trait InvalidProperty {
|
||||
fn invalid_property(&self) -> bool;
|
||||
}
|
||||
|
||||
impl<T: Default + PartialEq> InvalidProperty for T {
|
||||
fn invalid_property(&self) -> bool {
|
||||
self == &T::default()
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait(?Send)]
|
||||
pub trait ResourceService: Sized + 'static {
|
||||
type MemberType: Resource<Error = Self::Error>;
|
||||
|
||||
Reference in New Issue
Block a user