Skip to content

Commit

Permalink
todo
Browse files Browse the repository at this point in the history
  • Loading branch information
tu6ge committed May 7, 2024
1 parent aaf65fd commit 29b7a5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/register/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ macro_rules! panic_on_err {
};
}

impl<M: Send> Validator<'_, M> {
impl<M: Send + Clone> Validator<'_, M> {
/// # Register rules
///
/// **Feild support multiple formats:**
Expand Down Expand Up @@ -322,7 +322,7 @@ impl<M: Send> Validator<'_, M> {
}
}

impl<'v, M: Send> Validator<'v, M> {
impl<'v, M: Send + Clone> Validator<'v, M> {
/// Custom validate error message
///
/// Every rule has a default message, the method should be replace it with your need.
Expand Down
28 changes: 14 additions & 14 deletions src/rule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,26 +231,26 @@ impl<M> RuleList<M> {

#[must_use]
pub(crate) async fn call(self, data: Arc<Mutex<ValueMap>>) -> Vec<(&'static str, M)>
// where
// M: Clone,
where
M: Clone,
{
let RuleList { list, .. } = self;
let mut msg = Vec::with_capacity(list.len());

todo!();
//todo!();

// for endpoint in list.into_iter() {
// let d = data.clone();
// let _ = endpoint
// .call(d)
// .await
// .map_err(|e| msg.push((endpoint.name(), e.clone())));
for endpoint in list.into_iter() {
let d = data.lock().unwrap();
let _ = endpoint
.call(d)
.await
.map_err(|e| msg.push((endpoint.name(), e.clone())));

// if self.is_bail && !msg.is_empty() {
// msg.shrink_to_fit();
// return msg;
// }
// }
if self.is_bail && !msg.is_empty() {
msg.shrink_to_fit();
return msg;
}
}

msg.shrink_to_fit();
msg
Expand Down

0 comments on commit 29b7a5f

Please sign in to comment.