diff --git a/Cargo.toml b/Cargo.toml index 767d52908..c5cdf57f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,7 +162,7 @@ passfd = "0.1.6" percent-encoding = "2.3" pest = "2.7" pest_derive = "2.7" -phf = "0.11" +phf = {version="0.11", default-features=false} phf_codegen = "0.10" pkg-config = "0.3" plist = "1.7" @@ -221,7 +221,7 @@ time-funcs = { path = "lua-api-crates/time-funcs" } tiny-skia = "0.11" tokio = "1.43" toml = "0.8" -ucd-trie = "0.1" +ucd-trie = {version="0.1", default-features=false} uds_windows = "1.1" umask = { path = "umask" } unicode-normalization = "0.1.24" diff --git a/wezterm-char-props/Cargo.toml b/wezterm-char-props/Cargo.toml index c456544fd..5669400ec 100644 --- a/wezterm-char-props/Cargo.toml +++ b/wezterm-char-props/Cargo.toml @@ -16,6 +16,8 @@ serde = {workspace=true, optional=true} ucd-trie.workspace = true [features] +default = ["std"] +std = ["serde/std", "ucd-trie/std", "phf/std"] use_serde = ["serde"] [dev-dependencies] diff --git a/wezterm-char-props/src/lib.rs b/wezterm-char-props/src/lib.rs index 42c794120..e0960a49c 100644 --- a/wezterm-char-props/src/lib.rs +++ b/wezterm-char-props/src/lib.rs @@ -1,3 +1,4 @@ +#![cfg_attr(not(feature = "std"), no_std)] pub mod emoji; pub mod emoji_presentation; pub mod emoji_variation; diff --git a/wezterm-char-props/src/nerdfonts.rs b/wezterm-char-props/src/nerdfonts.rs index 585a92f6c..a5a168a9a 100644 --- a/wezterm-char-props/src/nerdfonts.rs +++ b/wezterm-char-props/src/nerdfonts.rs @@ -1,10 +1,14 @@ +#[cfg(feature = "std")] use std::collections::HashMap; +#[cfg(feature = "std")] use std::sync::LazyLock; +#[cfg(feature = "std")] pub static NERD_FONTS: LazyLock> = LazyLock::new(build_map); pub use crate::nerdfonts_data::NERD_FONT_GLYPHS; +#[cfg(feature = "std")] fn build_map() -> HashMap<&'static str, char> { crate::nerdfonts_data::NERD_FONT_GLYPHS .iter() diff --git a/wezterm-char-props/src/widechar_width.rs b/wezterm-char-props/src/widechar_width.rs index 17ab41cd9..0aaf34ef5 100644 --- a/wezterm-char-props/src/widechar_width.rs +++ b/wezterm-char-props/src/widechar_width.rs @@ -1515,7 +1515,7 @@ const WIDENED_TABLE: &'static [R] = &[ fn in_table(arr: &[R], c: u32) -> bool { arr.binary_search_by(|(start, end)| { if c >= *start && c <= *end { - std::cmp::Ordering::Equal + core::cmp::Ordering::Equal } else { start.cmp(&c) }