Crates.io | regex_static |
lib.rs | regex_static |
version | 0.1.1 |
source | src |
created_at | 2021-03-04 19:28:06.500742 |
updated_at | 2021-03-20 10:41:32.43104 |
description | Compile-time validated regex, with convenience functions for lazy and static regexes. |
homepage | |
repository | https://github.com/bbqsrc/regex-static |
max_upload_size | |
id | 363847 |
size | 3,443 |
Compile-time validation of regex::Regex
.
Uses once_cell
to lazily create the regex.
static RE: Lazy<Regex> = regex_static::lazy_regex!("^yesss$");
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$");
Will create an owned Regex
, just like calling Regex::new(...)
but with compile-time validation.
let ordinary_regex = regex_static::regex!("^yesss$");