Disable std feature for twox-hash to fix Wasm build
This commit is contained in:
parent
17470bf7d3
commit
da4182099d
2 changed files with 16 additions and 4 deletions
|
|
@ -35,9 +35,16 @@ futures = "0.3"
|
||||||
bitflags = "1.2"
|
bitflags = "1.2"
|
||||||
once_cell = "1.0"
|
once_cell = "1.0"
|
||||||
rustc-hash = "1.1"
|
rustc-hash = "1.1"
|
||||||
twox-hash = "1.6"
|
|
||||||
ouroboros = "0.15"
|
ouroboros = "0.15"
|
||||||
|
|
||||||
|
[dependencies.twox-hash]
|
||||||
|
version = "1.6"
|
||||||
|
default-features = false
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.twox-hash]
|
||||||
|
version = "1.6.1"
|
||||||
|
features = ["std"]
|
||||||
|
|
||||||
[dependencies.bytemuck]
|
[dependencies.bytemuck]
|
||||||
version = "1.9"
|
version = "1.9"
|
||||||
features = ["derive"]
|
features = ["derive"]
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ use std::cell::RefCell;
|
||||||
use std::collections::hash_map;
|
use std::collections::hash_map;
|
||||||
use std::hash::{BuildHasher, Hash, Hasher};
|
use std::hash::{BuildHasher, Hash, Hasher};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use twox_hash::RandomXxHashBuilder64;
|
|
||||||
|
|
||||||
#[allow(missing_debug_implementations)]
|
#[allow(missing_debug_implementations)]
|
||||||
pub struct Pipeline {
|
pub struct Pipeline {
|
||||||
|
|
@ -311,15 +310,21 @@ fn to_family(font: Font) -> glyphon::Family<'static> {
|
||||||
struct Cache<'a> {
|
struct Cache<'a> {
|
||||||
entries: FxHashMap<KeyHash, glyphon::Buffer<'a>>,
|
entries: FxHashMap<KeyHash, glyphon::Buffer<'a>>,
|
||||||
recently_used: FxHashSet<KeyHash>,
|
recently_used: FxHashSet<KeyHash>,
|
||||||
hasher: RandomXxHashBuilder64,
|
hasher: HashBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
type HashBuilder = twox_hash::RandomXxHashBuilder64;
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
type HashBuilder = std::hash::BuildHasherDefault<twox_hash::XxHash64>;
|
||||||
|
|
||||||
impl<'a> Cache<'a> {
|
impl<'a> Cache<'a> {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
entries: FxHashMap::default(),
|
entries: FxHashMap::default(),
|
||||||
recently_used: FxHashSet::default(),
|
recently_used: FxHashSet::default(),
|
||||||
hasher: RandomXxHashBuilder64::default(),
|
hasher: HashBuilder::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue