Skip to content

Commit

Permalink
Merge pull request #108 from bonofiglio/main
Browse files Browse the repository at this point in the history
feat: implement `Validate` for `Cow`
  • Loading branch information
jprochazk authored Jun 9, 2024
2 parents 9df6c68 + cbd5806 commit 8662bd9
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 8662bd9

Please sign in to comment.