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