mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
test: Af cloud workspace member (#3779)
* chore: implement workspace memeber events * chore: add workspace member test * chore: fix fmt
This commit is contained in:
@ -21,6 +21,7 @@ derivative = "2.2.0"
|
||||
serde_json = {version = "1.0", optional = true }
|
||||
serde = { version = "1.0", features = ["derive"], optional = true }
|
||||
serde_repr = { version = "0.1", optional = true }
|
||||
validator = "0.16.1"
|
||||
|
||||
#optional crate
|
||||
bincode = { version = "1.3", optional = true}
|
||||
|
@ -2,6 +2,7 @@ use std::fmt::{Debug, Formatter};
|
||||
use std::ops;
|
||||
|
||||
use bytes::Bytes;
|
||||
use validator::ValidationErrors;
|
||||
|
||||
use crate::{
|
||||
byte_trait::*,
|
||||
@ -11,6 +12,12 @@ use crate::{
|
||||
util::ready::{ready, Ready},
|
||||
};
|
||||
|
||||
pub trait AFPluginDataValidator {
|
||||
fn validate(self) -> Result<Self, ValidationErrors>
|
||||
where
|
||||
Self: Sized;
|
||||
}
|
||||
|
||||
pub struct AFPluginData<T>(pub T);
|
||||
|
||||
impl<T> AFPluginData<T> {
|
||||
@ -27,6 +34,16 @@ impl<T> ops::Deref for AFPluginData<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> AFPluginDataValidator for AFPluginData<T>
|
||||
where
|
||||
T: validator::Validate,
|
||||
{
|
||||
fn validate(self) -> Result<Self, ValidationErrors> {
|
||||
self.0.validate()?;
|
||||
Ok(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ops::DerefMut for AFPluginData<T> {
|
||||
fn deref_mut(&mut self) -> &mut T {
|
||||
&mut self.0
|
||||
|
Reference in New Issue
Block a user