replace regex with lazy-regex macros

This commit is contained in:
Quaternions 2023-10-03 16:28:35 -07:00
parent 58be446297
commit 9e9550885f
3 changed files with 26 additions and 3 deletions

25
Cargo.lock generated
View File

@ -834,6 +834,29 @@ dependencies = [
"pkg-config",
]
[[package]]
name = "lazy-regex"
version = "3.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e723bd417b2df60a0f6a2b6825f297ea04b245d4ba52b5a22cb679bdf58b05fa"
dependencies = [
"lazy-regex-proc_macros",
"once_cell",
"regex",
]
[[package]]
name = "lazy-regex-proc_macros"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f0a1d9139f0ee2e862e08a9c5d0ba0470f2aa21cd1e1aa1b1562f83116c725f"
dependencies = [
"proc-macro2",
"quote",
"regex",
"syn 2.0.29",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
@ -1666,6 +1689,7 @@ dependencies = [
"ddsfile",
"env_logger",
"glam",
"lazy-regex",
"log",
"obj",
"pollster",
@ -1673,7 +1697,6 @@ dependencies = [
"rbx_dom_weak",
"rbx_reflection_database",
"rbx_xml",
"regex",
"wgpu",
"winit",
]

View File

@ -11,6 +11,7 @@ bytemuck = { version = "1.13.1", features = ["derive"] }
ddsfile = "0.5.1"
env_logger = "0.10.0"
glam = "0.24.1"
lazy-regex = "3.0.2"
log = "0.4.20"
obj = "0.10.2"
pollster = "0.3.0"
@ -18,7 +19,6 @@ 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"
wgpu = "0.17.0"
winit = "0.28.6"

View File

@ -36,7 +36,7 @@ struct RobloxAssetIdParseErr;
impl std::str::FromStr for RobloxAssetId {
type Err=RobloxAssetIdParseErr;
fn from_str(s: &str) -> Result<Self, Self::Err>{
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::<u64>() {