Skip to content

Commit

Permalink
feat: implement Validate for Cow
Browse files Browse the repository at this point in the history
  • Loading branch information
bonofiglio committed Apr 23, 2024
1 parent 5b80e50 commit cbd5806
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions garde/src/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,19 @@ impl<T: Validate> Validate for Option<T> {
}
}
}

impl<'a, B: Validate> Validate for std::borrow::Cow<'a, B>
where
B: ToOwned,
{
type Context = B::Context;

fn validate_into(
&self,
ctx: &Self::Context,
parent: &mut dyn FnMut() -> Path,
report: &mut Report,
) {
self.as_ref().validate_into(ctx, parent, report)
}
}

0 comments on commit cbd5806

Please sign in to comment.