regex_static

Crates.ioregex_static
lib.rsregex_static
version0.1.1
sourcesrc
created_at2021-03-04 19:28:06.500742
updated_at2021-03-20 10:41:32.43104
descriptionCompile-time validated regex, with convenience functions for lazy and static regexes.
homepage
repositoryhttps://github.com/bbqsrc/regex-static
max_upload_size
id363847
size3,443
Brendan Molloy (bbqsrc)

documentation

README

regex_static

Compile-time validation of regex::Regex.

Examples

Lazy regex

Uses once_cell to lazily create the regex.

static RE: Lazy<Regex> = regex_static::lazy_regex!("^yesss$");

Static regex

Also uses once_cell, but works inline (will therefore reuse the same instance of the regex each function call).

let some_regex = regex_static::static_regex!("^yesss$");

Ordinary regex

Will create an owned Regex, just like calling Regex::new(...) but with compile-time validation.

let ordinary_regex = regex_static::regex!("^yesss$");
Commit count: 7

cargo fmt