Derive Macro Capturable

Source
#[derive(Capturable)]
{
    // Attributes available to this derive:
    #[regex_with]
}
Expand description

Helper macro for deriving the FromStr trait for a struct that captures regular expressions. regex_with that specifies the regular expression pattern.

§Attributes

  • regex_with: specifies the regex pattern used for capturing from a string.

§Example

use regex_with::Capturable;
#[derive(Capturable)]
#[regex_with(re = "^\\d+")]
struct Number;

This would generate a struct capable of capturing numerical strings using the provided regex pattern.