mirror of
https://github.com/actix/actix-web.git
synced 2024-11-03 15:39:50 +00:00
use hashbrown instead of std HashMap
This commit is contained in:
parent
c3d3e8b465
commit
12fb94204f
4 changed files with 7 additions and 45 deletions
|
@ -44,10 +44,6 @@ actix-codec = "0.1.0"
|
|||
actix-connector = { git = "https://github.com/actix/actix-net.git" }
|
||||
actix-utils = { git = "https://github.com/actix/actix-net.git" }
|
||||
|
||||
# actix-codec = { path="../actix-net/actix-codec/" }
|
||||
# actix-connector = { path="../actix-net/actix-connector/" }
|
||||
# actix-utils = { path="../actix-net/actix-utils/" }
|
||||
|
||||
base64 = "0.10"
|
||||
backtrace = "0.3"
|
||||
bitflags = "1.0"
|
||||
|
@ -57,6 +53,8 @@ cookie = { version="0.11", features=["percent-encode"] }
|
|||
derive_more = "0.13"
|
||||
encoding = "0.2"
|
||||
futures = "0.1"
|
||||
hashbrown = "0.1.8"
|
||||
h2 = "0.1.16"
|
||||
http = "0.1.8"
|
||||
httparse = "1.3"
|
||||
indexmap = "1.0"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::cell::RefCell;
|
||||
use std::collections::{HashMap, VecDeque};
|
||||
use std::collections::VecDeque;
|
||||
use std::io;
|
||||
use std::rc::Rc;
|
||||
use std::time::{Duration, Instant};
|
||||
|
@ -7,9 +7,10 @@ use std::time::{Duration, Instant};
|
|||
use actix_codec::{AsyncRead, AsyncWrite};
|
||||
use actix_service::Service;
|
||||
use futures::future::{ok, Either, FutureResult};
|
||||
use futures::sync::oneshot;
|
||||
use futures::task::AtomicTask;
|
||||
use futures::unsync::oneshot;
|
||||
use futures::{Async, Future, Poll};
|
||||
use hashbrown::HashMap;
|
||||
use http::uri::Authority;
|
||||
use indexmap::IndexSet;
|
||||
use slab::Slab;
|
||||
|
|
|
@ -1,40 +1,13 @@
|
|||
use std::any::{Any, TypeId};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::hash::{BuildHasherDefault, Hasher};
|
||||
|
||||
struct IdHasher {
|
||||
id: u64,
|
||||
}
|
||||
|
||||
impl Default for IdHasher {
|
||||
fn default() -> IdHasher {
|
||||
IdHasher { id: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
impl Hasher for IdHasher {
|
||||
fn write(&mut self, bytes: &[u8]) {
|
||||
for &x in bytes {
|
||||
self.id.wrapping_add(u64::from(x));
|
||||
}
|
||||
}
|
||||
|
||||
fn write_u64(&mut self, u: u64) {
|
||||
self.id = u;
|
||||
}
|
||||
|
||||
fn finish(&self) -> u64 {
|
||||
self.id
|
||||
}
|
||||
}
|
||||
|
||||
type AnyMap = HashMap<TypeId, Box<Any>, BuildHasherDefault<IdHasher>>;
|
||||
use hashbrown::HashMap;
|
||||
|
||||
#[derive(Default)]
|
||||
/// A type map of request extensions.
|
||||
pub struct Extensions {
|
||||
map: AnyMap,
|
||||
map: HashMap<TypeId, Box<Any>>,
|
||||
}
|
||||
|
||||
impl Extensions {
|
||||
|
|
|
@ -28,9 +28,6 @@ default = ["session"]
|
|||
# sessions feature, session require "ring" crate and c compiler
|
||||
session = ["cookie/secure"]
|
||||
|
||||
# openssl
|
||||
ssl = ["openssl", "actix-http/ssl"]
|
||||
|
||||
[dependencies]
|
||||
actix-codec = "0.1"
|
||||
actix-service = "0.1.6"
|
||||
|
@ -39,10 +36,6 @@ actix-server = "0.1.0"
|
|||
actix-http = { path=".." }
|
||||
actix-utils = { git = "https://github.com/actix/actix-net.git" }
|
||||
|
||||
# actix-codec = { path="../actix-net/actix-codec/" }
|
||||
# actix-rt = { path="../actix-net/actix-rt/" }
|
||||
# actix-server = { path="../actix-net/actix-server/" }
|
||||
|
||||
base64 = "0.10"
|
||||
bytes = "0.4"
|
||||
cookie = { version="0.11", features=["percent-encode"] }
|
||||
|
@ -59,6 +52,3 @@ serde_urlencoded = "0.5.3"
|
|||
time = "0.1"
|
||||
tokio-tcp = "0.1"
|
||||
tokio-timer = "0.2"
|
||||
|
||||
# openssl
|
||||
openssl = { version="0.10", optional = true }
|
||||
|
|
Loading…
Reference in a new issue