summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-30 15:57:12 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-30 15:57:50 +0100
commitfaa53647cc83577e1ecb81a450c948b3fa4203e0 (patch)
tree388f4dfa961d464643891593d4c2ac420ac6d458
parent35af0aa84f76daddbb6d6959f9746bd09e306278 (diff)
downloadiced-faa53647cc83577e1ecb81a450c948b3fa4203e0.tar.gz
iced-faa53647cc83577e1ecb81a450c948b3fa4203e0.tar.bz2
iced-faa53647cc83577e1ecb81a450c948b3fa4203e0.zip
Replace `xxhash-rust` with `rustc-hash`
-rw-r--r--Cargo.toml1
-rw-r--r--core/Cargo.toml2
-rw-r--r--core/src/hasher.rs2
-rw-r--r--graphics/Cargo.toml1
-rw-r--r--graphics/src/text/cache.rs11
-rw-r--r--tiny_skia/Cargo.toml1
6 files changed, 6 insertions, 12 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 8a6246c8..bf05ed1d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -155,7 +155,6 @@ thiserror = "1.0"
tiny-skia = "0.11"
tokio = "1.0"
tracing = "0.1"
-xxhash-rust = { version = "0.8", features = ["xxh3"] }
unicode-segmentation = "1.0"
wasm-bindgen-futures = "0.4"
wasm-timer = "0.2"
diff --git a/core/Cargo.toml b/core/Cargo.toml
index 32d233ee..d3529d98 100644
--- a/core/Cargo.toml
+++ b/core/Cargo.toml
@@ -21,10 +21,10 @@ log.workspace = true
num-traits.workspace = true
once_cell.workspace = true
palette.workspace = true
+rustc-hash.workspace = true
smol_str.workspace = true
thiserror.workspace = true
web-time.workspace = true
-xxhash-rust.workspace = true
dark-light.workspace = true
dark-light.optional = true
diff --git a/core/src/hasher.rs b/core/src/hasher.rs
index a13d78af..13180e41 100644
--- a/core/src/hasher.rs
+++ b/core/src/hasher.rs
@@ -1,7 +1,7 @@
/// The hasher used to compare layouts.
#[allow(missing_debug_implementations)] // Doesn't really make sense to have debug on the hasher state anyways.
#[derive(Default)]
-pub struct Hasher(xxhash_rust::xxh3::Xxh3);
+pub struct Hasher(rustc_hash::FxHasher);
impl core::hash::Hasher for Hasher {
fn write(&mut self, bytes: &[u8]) {
diff --git a/graphics/Cargo.toml b/graphics/Cargo.toml
index 0ee6ff47..a42ed477 100644
--- a/graphics/Cargo.toml
+++ b/graphics/Cargo.toml
@@ -34,7 +34,6 @@ raw-window-handle.workspace = true
rustc-hash.workspace = true
thiserror.workspace = true
unicode-segmentation.workspace = true
-xxhash-rust.workspace = true
image.workspace = true
image.optional = true
diff --git a/graphics/src/text/cache.rs b/graphics/src/text/cache.rs
index 7fb33567..b6473f85 100644
--- a/graphics/src/text/cache.rs
+++ b/graphics/src/text/cache.rs
@@ -2,9 +2,9 @@
use crate::core::{Font, Size};
use crate::text;
-use rustc_hash::{FxHashMap, FxHashSet};
+use rustc_hash::{FxHashMap, FxHashSet, FxHasher};
use std::collections::hash_map;
-use std::hash::{BuildHasher, Hash, Hasher};
+use std::hash::{Hash, Hasher};
/// A store of recently used sections of text.
#[allow(missing_debug_implementations)]
@@ -13,11 +13,8 @@ pub struct Cache {
entries: FxHashMap<KeyHash, Entry>,
aliases: FxHashMap<KeyHash, KeyHash>,
recently_used: FxHashSet<KeyHash>,
- hasher: HashBuilder,
}
-type HashBuilder = xxhash_rust::xxh3::Xxh3Builder;
-
impl Cache {
/// Creates a new empty [`Cache`].
pub fn new() -> Self {
@@ -35,7 +32,7 @@ impl Cache {
font_system: &mut cosmic_text::FontSystem,
key: Key<'_>,
) -> (KeyHash, &mut Entry) {
- let hash = key.hash(self.hasher.build_hasher());
+ let hash = key.hash(FxHasher::default());
if let Some(hash) = self.aliases.get(&hash) {
let _ = self.recently_used.insert(*hash);
@@ -77,7 +74,7 @@ impl Cache {
] {
if key.bounds != bounds {
let _ = self.aliases.insert(
- Key { bounds, ..key }.hash(self.hasher.build_hasher()),
+ Key { bounds, ..key }.hash(FxHasher::default()),
hash,
);
}
diff --git a/tiny_skia/Cargo.toml b/tiny_skia/Cargo.toml
index 68b2a03a..44a894a1 100644
--- a/tiny_skia/Cargo.toml
+++ b/tiny_skia/Cargo.toml
@@ -25,7 +25,6 @@ log.workspace = true
rustc-hash.workspace = true
softbuffer.workspace = true
tiny-skia.workspace = true
-xxhash-rust.workspace = true
resvg.workspace = true
resvg.optional = true