Merge pull request #168 from grovesNL/nostd-hash
Move hashbrown behind `no_std` feature
This commit is contained in:
commit
618896f1a5
4 changed files with 19 additions and 12 deletions
|
|
@ -21,7 +21,7 @@ unicode-linebreak = "0.1.4"
|
||||||
unicode-script = "0.5.5"
|
unicode-script = "0.5.5"
|
||||||
unicode-segmentation = "1.10.0"
|
unicode-segmentation = "1.10.0"
|
||||||
rangemap = "1.2.0"
|
rangemap = "1.2.0"
|
||||||
hashbrown = { version = "0.14.0", default-features = false }
|
hashbrown = { version = "0.14.0", optional = true, default-features = false }
|
||||||
rustc-hash = { version = "1.1.0", default-features = false }
|
rustc-hash = { version = "1.1.0", default-features = false }
|
||||||
|
|
||||||
[dependencies.unicode-bidi]
|
[dependencies.unicode-bidi]
|
||||||
|
|
@ -33,6 +33,7 @@ features = ["hardcoded-data"]
|
||||||
default = ["std", "swash"]
|
default = ["std", "swash"]
|
||||||
no_std = [
|
no_std = [
|
||||||
"rustybuzz/libm",
|
"rustybuzz/libm",
|
||||||
|
"hashbrown",
|
||||||
]
|
]
|
||||||
std = [
|
std = [
|
||||||
"fontdb/memmap",
|
"fontdb/memmap",
|
||||||
|
|
|
||||||
16
ci.sh
16
ci.sh
|
|
@ -13,20 +13,20 @@ cargo fmt --check
|
||||||
echo Build with default features
|
echo Build with default features
|
||||||
build
|
build
|
||||||
|
|
||||||
echo Build with no default features
|
echo Build with only no_std feature
|
||||||
build --no-default-features
|
build --no-default-features --features no_std
|
||||||
|
|
||||||
echo Build with only std feature
|
echo Build with only std feature
|
||||||
build --no-default-features --features std
|
build --no-default-features --features std
|
||||||
|
|
||||||
echo Build with only swash feature
|
echo Build with only std and swash features
|
||||||
build --no-default-features --features swash
|
build --no-default-features --features std,swash
|
||||||
|
|
||||||
echo Build with only syntect feature
|
echo Build with only std and syntect features
|
||||||
build --no-default-features --features syntect
|
build --no-default-features --features std,syntect
|
||||||
|
|
||||||
echo Build with only vi feature
|
echo Build with only std and vi features
|
||||||
build --no-default-features --features vi
|
build --no-default-features --features std,vi
|
||||||
|
|
||||||
echo Build with all features
|
echo Build with all features
|
||||||
build --all-features
|
build --all-features
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,14 @@ use alloc::string::String;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use core::hash::BuildHasherDefault;
|
|
||||||
use core::ops::{Deref, DerefMut};
|
use core::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
type HashMap<K, V> = hashbrown::HashMap<K, V, BuildHasherDefault<rustc_hash::FxHasher>>;
|
type BuildHasher = core::hash::BuildHasherDefault<rustc_hash::FxHasher>;
|
||||||
|
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
type HashMap<K, V> = std::collections::HashMap<K, V, BuildHasher>;
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
type HashMap<K, V> = hashbrown::HashMap<K, V, BuildHasher>;
|
||||||
|
|
||||||
// re-export fontdb and rustybuzz
|
// re-export fontdb and rustybuzz
|
||||||
pub use fontdb;
|
pub use fontdb;
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,11 @@
|
||||||
// Ensure numbers are readable
|
// Ensure numbers are readable
|
||||||
#![warn(clippy::unreadable_literal)]
|
#![warn(clippy::unreadable_literal)]
|
||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
|
||||||
|
#[cfg(not(any(feature = "std", feature = "no_std")))]
|
||||||
|
compile_error!("Either the `std` or `no_std` feature must be enabled");
|
||||||
|
|
||||||
pub use self::attrs::*;
|
pub use self::attrs::*;
|
||||||
mod attrs;
|
mod attrs;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue