From a386f90f51118a66c8d5bc41c997e2a662c20f9b Mon Sep 17 00:00:00 2001 From: Quaternions Date: Sat, 18 Nov 2023 15:47:54 -0800 Subject: [PATCH] switch to lazy_regex --- Cargo.lock | 25 ++++++++++++++++++++++++- Cargo.toml | 2 +- src/main.rs | 2 +- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d18f494..9697a57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -609,6 +609,29 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy-regex" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.38", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -688,11 +711,11 @@ dependencies = [ "flate2", "image", "image_dds", + "lazy-regex", "rbx_binary", "rbx_dom_weak", "rbx_reflection_database", "rbx_xml", - "regex", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a41142b..1c0d699 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,11 +11,11 @@ clap = { version = "4.4.2", features = ["derive"] } flate2 = "1.0.27" image = "0.24.7" image_dds = "0.1.1" +lazy-regex = "3.1.0" rbx_binary = "0.7.1" rbx_dom_weak = "2.5.0" rbx_reflection_database = "0.2.7" rbx_xml = "0.13.1" -regex = "1.9.5" #[profile.release] #lto = true diff --git a/src/main.rs b/src/main.rs index 8b6d61f..3343008 100644 --- a/src/main.rs +++ b/src/main.rs @@ -264,7 +264,7 @@ struct RobloxAssetIdParseErr; impl std::str::FromStr for RobloxAssetId { type Err=RobloxAssetIdParseErr; fn from_str(s: &str) -> Result{ - let regman=regex::Regex::new(r"(\d+)$").unwrap(); + let regman=lazy_regex::regex!(r"(\d+)$"); if let Some(captures) = regman.captures(s) { if captures.len()==2{//captures[0] is all captures concatenated, and then each individual capture if let Ok(id) = captures[0].parse::() {