lure 0.1.1

Safe & Efficient Regex in Rust – Compile-Time Validation & Single Compilation
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 5.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 123.23 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 21s Average build duration of successful builds.
  • all releases: 24s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • luander

lure

Crates.io Version Docs.rs Latest cicd

Safe & Efficient Regex in Rust – Compile-Time Validation & Single Compilation

This crate contains a macro to generate a lazy Regex and perform regex validation. The code fails to compile if the regex is invalid.

Usage

This Rust crate helps prevent common pitfalls when working with regular expressions by ensuring patterns are valid at compile time and avoiding redundant compilations. It leverages the standard library OnceCell to compile regexes only once and uses a procedural macro for compile-time validation, improving both safety and performance. The only dependency in the crate if regex

Example:

use lure::regex;

// Password regex
let re = regex!("/^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$/");
assert!(re.is_match("Test1234ccc#"));

License

Licensed under Apache License, Version 2.0 (LICENSE or http://www.apache.org/licenses/LICENSE-2.0)