Re-export various types

This commit is contained in:
Nikolay Kim 2021-02-24 12:56:34 +06:00
parent 8f016592fd
commit 0d9be13180
11 changed files with 25 additions and 20 deletions

View file

@ -1,5 +1,9 @@
# Changes
## [0.3.2] - 2021-02-25
* Re-export various types
## [0.3.1] - 2021-02-24
* server: Make TestServer::connect() async

View file

@ -1,6 +1,6 @@
[package]
name = "ntex"
version = "0.3.1"
version = "0.3.2"
authors = ["ntex contributors <team@ntex.rs>"]
description = "Framework for composable network services"
readme = "README.md"

View file

@ -4,7 +4,7 @@ use futures::future::{ready, FutureExt};
use crate::framed::State;
use crate::rt::time::delay_for;
use crate::HashSet;
use crate::util::HashSet;
pub struct Timer(Rc<RefCell<Inner>>);

View file

@ -2,7 +2,6 @@ use std::task::{Context, Poll};
use std::time::{Duration, Instant};
use std::{cell::RefCell, collections::VecDeque, pin::Pin, rc::Rc};
use bytes::Bytes;
use futures::future::{poll_fn, Future, FutureExt, LocalBoxFuture};
use h2::client::{handshake, Connection, SendRequest};
use http::uri::Authority;
@ -13,7 +12,7 @@ use crate::http::Protocol;
use crate::rt::{spawn, time::delay_for, time::Delay};
use crate::service::Service;
use crate::task::LocalWaker;
use crate::HashMap;
use crate::util::{Bytes, HashMap};
use super::connection::{ConnectionType, IoConnection};
use super::error::ConnectError;

View file

@ -1,10 +1,9 @@
use std::collections::hash_map::{self, Entry};
use std::convert::TryFrom;
use either::Either;
use http::header::{HeaderName, HeaderValue};
use crate::HashMap;
use crate::util::{Either, HashMap};
/// A set of HTTP headers
///

View file

@ -60,6 +60,3 @@ pub mod rt {
pub mod service {
pub use ntex_service::*;
}
type HashMap<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;
type HashSet<V> = std::collections::HashSet<V, ahash::RandomState>;

View file

@ -1,4 +1,3 @@
use std::collections::HashMap;
use std::{fmt, io, net};
use futures::future::{ok, Future, FutureExt, LocalBoxFuture};
@ -6,7 +5,7 @@ use log::error;
use crate::rt::net::TcpStream;
use crate::service;
use crate::util::counter::CounterGuard;
use crate::util::{counter::CounterGuard, HashMap};
use super::builder::bind_addr;
use super::service::{
@ -82,8 +81,8 @@ impl ConfiguredService {
pub(super) fn new(rt: Box<dyn ServiceRuntimeConfiguration>) -> Self {
ConfiguredService {
rt,
names: HashMap::new(),
topics: HashMap::new(),
names: HashMap::default(),
topics: HashMap::default(),
services: Vec::new(),
}
}
@ -191,7 +190,7 @@ impl ServiceRuntime {
fn new(names: HashMap<String, Token>) -> Self {
ServiceRuntime {
names,
services: HashMap::new(),
services: HashMap::default(),
onstart: Vec::new(),
}
}

View file

@ -3,7 +3,7 @@ use std::{any::Any, any::TypeId, fmt};
#[derive(Default)]
/// A type map of request extensions.
pub struct Extensions {
map: crate::HashMap<TypeId, Box<dyn Any>>,
map: crate::util::HashMap<TypeId, Box<dyn Any>>,
}
impl Extensions {
@ -11,7 +11,7 @@ impl Extensions {
#[inline]
pub fn new() -> Extensions {
Extensions {
map: crate::HashMap::default(),
map: Default::default(),
}
}

View file

@ -9,3 +9,10 @@ pub mod timeout;
pub mod variant;
pub use self::extensions::Extensions;
pub use bytes::{Buf, BufMut, Bytes, BytesMut};
pub use bytestring::ByteString;
pub use either::Either;
pub type HashMap<K, V> = std::collections::HashMap<K, V, ahash::RandomState>;
pub type HashSet<V> = std::collections::HashSet<V, ahash::RandomState>;

View file

@ -1,5 +1,4 @@
//! Request logging middleware
use std::collections::HashSet;
use std::convert::TryFrom;
use std::env;
use std::error::Error;
@ -17,6 +16,7 @@ use time::OffsetDateTime;
use crate::http::body::{Body, BodySize, MessageBody, ResponseBody};
use crate::http::header::HeaderName;
use crate::service::{Service, Transform};
use crate::util::HashSet;
use crate::web::dev::{WebRequest, WebResponse};
use crate::web::HttpResponse;
@ -91,7 +91,7 @@ impl Logger {
Logger {
inner: Rc::new(Inner {
format: Format::new(format),
exclude: HashSet::new(),
exclude: HashSet::default(),
}),
}
}
@ -116,7 +116,7 @@ impl Default for Logger {
Logger {
inner: Rc::new(Inner {
format: Format::default(),
exclude: HashSet::new(),
exclude: HashSet::default(),
}),
}
}

View file

@ -3,9 +3,9 @@ use std::{cell::RefCell, rc::Rc};
use url::Url;
use crate::router::ResourceDef;
use crate::util::HashMap;
use crate::web::error::UrlGenerationError;
use crate::web::httprequest::HttpRequest;
use crate::HashMap;
#[derive(Clone, Debug)]
pub struct ResourceMap {