From 3b314e4c8cef48d13069aeb79d7125f1c13696b2 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 19 Apr 2019 17:43:52 -0700 Subject: [PATCH] Connect::set_addr() --- actix-connect/CHANGES.md | 5 +++++ actix-connect/Cargo.toml | 6 +++--- actix-connect/src/connect.rs | 8 ++++++++ actix-service/src/boxed.rs | 5 ++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/actix-connect/CHANGES.md b/actix-connect/CHANGES.md index 06208d99..ccb895e2 100644 --- a/actix-connect/CHANGES.md +++ b/actix-connect/CHANGES.md @@ -1,5 +1,10 @@ # Changes +## [0.1.5] - 2019-04-19 + +### Added + +* `Connect::set_addr()` ### Changed diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index b6db4c28..210848c7 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-connect" -version = "0.1.4" +version = "0.1.5" authors = ["Nikolay Kim "] description = "Actix Connector - tcp connector service" keywords = ["network", "framework", "async", "futures"] @@ -34,9 +34,9 @@ actix-service = "0.3.6" actix-codec = "0.1.2" actix-utils = "0.3.5" derive_more = "0.14.0" -either = "1.5.1" +either = "1.5.2" futures = "0.1.25" -http = { version = "0.1.16", optional = true } +http = { version = "0.1.17", optional = true } log = "0.4" tokio-tcp = "0.1.3" tokio-current-thread = "0.1.5" diff --git a/actix-connect/src/connect.rs b/actix-connect/src/connect.rs index 0565cbea..435a3497 100644 --- a/actix-connect/src/connect.rs +++ b/actix-connect/src/connect.rs @@ -69,6 +69,14 @@ impl Connect { self } + /// Use address. + pub fn set_addr(mut self, addr: Option) -> Self { + if let Some(addr) = addr { + self.addr = Some(Either::Left(addr)); + } + self + } + /// Host name pub fn host(&self) -> &str { self.req.host() diff --git a/actix-service/src/boxed.rs b/actix-service/src/boxed.rs index afd99d81..ab7fbecb 100644 --- a/actix-service/src/boxed.rs +++ b/actix-service/src/boxed.rs @@ -8,10 +8,13 @@ pub type BoxedService = Box< Request = Req, Response = Res, Error = Err, - Future = Either, Box>>, + Future = BoxedServiceResponse, >, >; +pub type BoxedServiceResponse = + Either, Box>>; + /// Create boxed new service pub fn new_service( service: T,