v0.1.3-rc.3.3

限制 `TOKEN_DELIMITER` 为 ASCII 避免问题
This commit is contained in:
wisdgod
2025-01-18 04:19:55 +08:00
parent 742c2e1c5c
commit 3e304f53d4
10 changed files with 43 additions and 112 deletions

View File

@@ -24,12 +24,12 @@ pub fn parse_string_from_env(key: &str, default: &str) -> String {
std::env::var(key).unwrap_or_else(|_| default.to_string())
}
pub fn parse_char_from_env(key: &str, default: char) -> char {
pub fn parse_ascii_char_from_env(key: &str, default: char) -> char {
std::env::var(key)
.ok()
.and_then(|v| {
let chars: Vec<char> = v.chars().collect();
if chars.len() == 1 {
if chars.len() == 1 && chars[0].is_ascii() {
Some(chars[0])
} else {
None