1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 23:42:56 +01:00

Connect::set_addr()

This commit is contained in:
Nikolay Kim 2019-04-19 17:43:52 -07:00
parent ae27b87641
commit 3b314e4c8c
4 changed files with 20 additions and 4 deletions

View File

@ -1,5 +1,10 @@
# Changes # Changes
## [0.1.5] - 2019-04-19
### Added
* `Connect::set_addr()`
### Changed ### Changed

View File

@ -1,6 +1,6 @@
[package] [package]
name = "actix-connect" name = "actix-connect"
version = "0.1.4" version = "0.1.5"
authors = ["Nikolay Kim <fafhrd91@gmail.com>"] authors = ["Nikolay Kim <fafhrd91@gmail.com>"]
description = "Actix Connector - tcp connector service" description = "Actix Connector - tcp connector service"
keywords = ["network", "framework", "async", "futures"] keywords = ["network", "framework", "async", "futures"]
@ -34,9 +34,9 @@ actix-service = "0.3.6"
actix-codec = "0.1.2" actix-codec = "0.1.2"
actix-utils = "0.3.5" actix-utils = "0.3.5"
derive_more = "0.14.0" derive_more = "0.14.0"
either = "1.5.1" either = "1.5.2"
futures = "0.1.25" futures = "0.1.25"
http = { version = "0.1.16", optional = true } http = { version = "0.1.17", optional = true }
log = "0.4" log = "0.4"
tokio-tcp = "0.1.3" tokio-tcp = "0.1.3"
tokio-current-thread = "0.1.5" tokio-current-thread = "0.1.5"

View File

@ -69,6 +69,14 @@ impl<T: Address> Connect<T> {
self self
} }
/// Use address.
pub fn set_addr(mut self, addr: Option<SocketAddr>) -> Self {
if let Some(addr) = addr {
self.addr = Some(Either::Left(addr));
}
self
}
/// Host name /// Host name
pub fn host(&self) -> &str { pub fn host(&self) -> &str {
self.req.host() self.req.host()

View File

@ -8,10 +8,13 @@ pub type BoxedService<Req, Res, Err> = Box<
Request = Req, Request = Req,
Response = Res, Response = Res,
Error = Err, Error = Err,
Future = Either<FutureResult<Res, Err>, Box<Future<Item = Res, Error = Err>>>, Future = BoxedServiceResponse<Res, Err>,
>, >,
>; >;
pub type BoxedServiceResponse<Res, Err> =
Either<FutureResult<Res, Err>, Box<Future<Item = Res, Error = Err>>>;
/// Create boxed new service /// Create boxed new service
pub fn new_service<T, C>( pub fn new_service<T, C>(
service: T, service: T,