From 42a4aa941b70ded2dd3be9e9f892471023e70229 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Fri, 26 Jul 2024 13:18:22 +0800 Subject: [PATCH] Add unicode feature to switch between `regex` and `regex-lite` dep --- Cargo.toml | 7 ++++++- src/lib.rs | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1df4597c..00bbc4a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,9 @@ edition = "2018" [dependencies] encoding_rs = "0.8.32" lazy_static = "1.4.0" -regex = "1.5.5" +regex = { version = "1.5.5", optional = true } +regex-lite = { version = "0.1" } + +[features] +default = ["unicode"] +unicode = ["dep:regex"] diff --git a/src/lib.rs b/src/lib.rs index a64c550f..abb5961b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,7 +71,10 @@ use encoding_rs::EncoderResult; use encoding_rs::Encoding; use encoding_rs::WINDOWS_1252; use lazy_static::lazy_static; +#[cfg(feature = "unicode")] use regex::Regex; +#[cfg(not(feature = "unicode"))] +use regex_lite::Regex; use std::collections::HashMap; use std::collections::VecDeque; use std::convert::From; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy