Skip to content

Commit

Permalink
Add a bit of doc on ExtraValidateAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
greyblake committed Aug 24, 2024
1 parent 940de6a commit 9be4ce6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nutype_macros/src/common/parse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ enum ValidateAttr<Validator: Parse + Kinded> {
Extra(ExtraValidateAttr),
}

/// Non standard (custom) validation attributes.
/// Responsible for parsing `error` and `with` attributes.
#[derive(Debug, Kinded)]
#[kinded(display = "snake_case")]
enum ExtraValidateAttr {
Expand Down Expand Up @@ -108,6 +110,7 @@ where
Validator: Parse + Kinded,
<Validator as Kinded>::Kind: Kind + Display + 'static,
{
/// Try to parse either standard validation attributes or combination of `error` and `with` attributes.
fn parse(input: ParseStream) -> syn::Result<Self> {
// NOTE: ParseStream has interior mutability, so we want to try to parse validator,
// but we don't want to advance the input if it fails.
Expand Down

0 comments on commit 9be4ce6

Please sign in to comment.