use rustc hash

This commit is contained in:
Toshit Chawda 2024-12-07 13:05:12 -08:00
parent 583a78bcc0
commit 5a7917f292
No known key found for this signature in database
GPG key ID: 91480ED99E2B3D9D
3 changed files with 14 additions and 14 deletions

14
Cargo.lock generated
View file

@ -1649,12 +1649,6 @@ dependencies = [
"libc",
]
[[package]]
name = "nohash-hasher"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
[[package]]
name = "nom"
version = "7.1.3"
@ -2004,6 +1998,12 @@ version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
[[package]]
name = "rustc-hash"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497"
[[package]]
name = "rustc_version"
version = "0.4.1"
@ -3206,9 +3206,9 @@ dependencies = [
"flume",
"futures",
"getrandom",
"nohash-hasher",
"pin-project-lite",
"reusable-box-future",
"rustc-hash",
"thiserror 2.0.3",
"tokio",
]

View file

@ -24,9 +24,9 @@ fastwebsockets = { version = "0.8.0", features = ["unstable-split"], optional =
flume = "0.11.0"
futures = "0.3.30"
getrandom = { version = "0.2.15", features = ["std"], optional = true }
nohash-hasher = "0.2.0"
pin-project-lite = "0.2.14"
reusable-box-future = "0.2.0"
rustc-hash = "2.1.0"
thiserror = "2.0.3"
tokio = { version = "1.39.3", optional = true, default-features = false }

View file

@ -1,7 +1,7 @@
use std::sync::{
use std::{collections::HashMap, sync::{
atomic::{AtomicBool, AtomicU32, Ordering},
Arc,
};
}};
use crate::{
extensions::AnyProtocolExtension,
@ -13,7 +13,7 @@ use bytes::BytesMut;
use event_listener::Event;
use flume as mpsc;
use futures::{channel::oneshot, select, stream::unfold, FutureExt, StreamExt};
use nohash_hasher::IntMap;
use rustc_hash::FxHashMap;
pub(crate) enum WsEvent<W: WebSocketWrite + 'static> {
Close(Packet<'static>, oneshot::Sender<Result<(), WispError>>),
@ -60,7 +60,7 @@ pub(crate) struct MuxInner<R: WebSocketRead + 'static, W: WebSocketWrite + 'stat
actor_tx: mpsc::Sender<WsEvent<W>>,
fut_exited: Arc<AtomicBool>,
stream_map: IntMap<u32, MuxMapValue>,
stream_map: FxHashMap<u32, MuxMapValue>,
buffer_size: u32,
target_buffer_size: u32,
@ -122,7 +122,7 @@ impl<R: WebSocketRead + 'static, W: WebSocketWrite + 'static> MuxInner<R, W> {
role: Role::Server,
stream_map: IntMap::default(),
stream_map: HashMap::default(),
server_tx,
},
@ -162,7 +162,7 @@ impl<R: WebSocketRead + 'static, W: WebSocketWrite + 'static> MuxInner<R, W> {
role: Role::Client,
stream_map: IntMap::default(),
stream_map: HashMap::default(),
server_tx,
},