test: Af cloud workspace member (#3779)

* chore: implement workspace memeber events

* chore: add workspace member test

* chore: fix fmt
This commit is contained in:
Nathan.fooo
2023-10-25 21:35:47 +08:00
committed by GitHub
parent ad21a61ffb
commit 48582cb718
28 changed files with 620 additions and 262 deletions

View File

@ -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}

View File

@ -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