Replace lazy_static and OnceLock with LazyLock

This commit is contained in:
mdecimus
2024-08-09 15:38:19 +02:00
parent 39a64ed64c
commit f957cbb60f
10 changed files with 160 additions and 167 deletions

View File

@@ -13,7 +13,6 @@ serde = { version = "1.0", features = ["derive"]}
bincode = "1.3.3"
nohash = "0.2.0"
ahash = "0.8.3"
lazy_static = "1.4"
whatlang = "0.16" # Language detection
rust-stemmers = "1.2" # Stemmers
tinysegmenter = "0.1" # Japanese tokenizer

View File

@@ -4,16 +4,13 @@
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-SEL
*/
use std::{borrow::Cow, vec::IntoIter};
use std::{borrow::Cow, sync::LazyLock, vec::IntoIter};
use jieba_rs::Jieba;
use super::{InnerToken, Token};
use lazy_static::lazy_static;
lazy_static! {
pub static ref JIEBA: Jieba = Jieba::new();
}
pub(crate) static JIEBA: LazyLock<Jieba> = LazyLock::new(Jieba::new);
pub struct ChineseTokenizer<'x, T, I>
where