From 0c5f1da625b97370e75206218586375936b30ee2 Mon Sep 17 00:00:00 2001 From: Matt Kantor Date: Tue, 28 Jul 2020 13:46:53 -0700 Subject: [PATCH 1/9] Remove garbled doc comment for actix_router::IntoPattern::is_single (#168) --- router/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/router/src/lib.rs b/router/src/lib.rs index 75485b5a..f97b34e8 100644 --- a/router/src/lib.rs +++ b/router/src/lib.rs @@ -37,7 +37,6 @@ impl ResourcePath for bytestring::ByteString { /// Helper trait for type that could be converted to path pattern pub trait IntoPattern { - /// Signle patter fn is_single(&self) -> bool; fn patterns(&self) -> Vec; From 235a76dcd471dba6854ebe5929ff72c85c378f6e Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 29 Jul 2020 08:47:32 +0900 Subject: [PATCH 2/9] GHA: Switch action to the official setup-msys2 (#169) --- .github/workflows/bench.yml | 2 +- .github/workflows/linux.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/windows-mingw.yml | 8 ++++---- .github/workflows/windows.yml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index a8615de8..7c76e171 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Install Rust uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 610c549a..1af85ff7 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Install ${{ matrix.version }} uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 87c87b88..98788274 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -21,7 +21,7 @@ jobs: runs-on: macos-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Install ${{ matrix.version }} uses: actions-rs/toolchain@v1 diff --git a/.github/workflows/windows-mingw.yml b/.github/workflows/windows-mingw.yml index b41d32cc..b83d251b 100644 --- a/.github/workflows/windows-mingw.yml +++ b/.github/workflows/windows-mingw.yml @@ -21,7 +21,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Install ${{ matrix.version }} uses: actions-rs/toolchain@v1 @@ -31,12 +31,12 @@ jobs: override: true - name: Install MSYS2 - uses: numworks/setup-msys2@v1 + uses: msys2/setup-msys2@v2 - name: Install packages run: | - msys2do pacman -Sy --noconfirm pacman - msys2do pacman --noconfirm -S base-devel pkg-config + msys2 -c 'pacman -Sy --noconfirm pacman' + msys2 -c 'pacman --noconfirm -S base-devel pkg-config' - name: check build uses: actions-rs/cargo@v1 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e0de16cc..a319fd65 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -27,7 +27,7 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: Install ${{ matrix.version }} uses: actions-rs/toolchain@v1 From ed4b708c66c7032eeb0198ff81663df41e4d9406 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Wed, 5 Aug 2020 09:02:41 +0900 Subject: [PATCH 3/9] Fix CI on MSRV check (#171) --- .github/workflows/linux.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1af85ff7..835d0d42 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -65,7 +65,7 @@ jobs: - name: Generate coverage file if: matrix.version == 'stable' && (github.ref == 'refs/heads/master' || github.event_name == 'pull_request') run: | - which cargo-tarpaulin || cargo install cargo-tarpaulin + cargo install cargo-tarpaulin cargo tarpaulin --out Xml --workspace --all-features - name: Upload to Codecov @@ -76,5 +76,7 @@ jobs: - name: Clear the cargo caches run: | - which cargo-cache || cargo install cargo-cache --no-default-features --features ci-autoclean + rustup update stable + rustup override set stable + cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache From 02aaa755915c02f2c4770788b8714abc6a7ea683 Mon Sep 17 00:00:00 2001 From: Miloas <0x9357@gmail.com> Date: Thu, 6 Aug 2020 18:21:51 +0800 Subject: [PATCH 4/9] fix actix-service doc error (#172) --- actix-service/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix-service/src/lib.rs b/actix-service/src/lib.rs index 68a5dbc6..e1493ac1 100644 --- a/actix-service/src/lib.rs +++ b/actix-service/src/lib.rs @@ -52,7 +52,7 @@ pub use self::transform::{apply, Transform}; /// type Request = u8; /// type Response = u64; /// type Error = MyError; -/// type Future = Pin>>; +/// type Future = Pin>>>; /// /// fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll> { ... } /// From afb0a3c9fc813d49c5f2b43657561eace02fe6b0 Mon Sep 17 00:00:00 2001 From: Igor Aleksanov Date: Fri, 7 Aug 2020 11:16:45 +0300 Subject: [PATCH 5/9] actix-service: Fix clippy warning in benches (#174) --- actix-service/benches/and_then.rs | 3 +-- actix-service/benches/unsafecell_vs_refcell.rs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/actix-service/benches/and_then.rs b/actix-service/benches/and_then.rs index 98de007d..f4174dd7 100644 --- a/actix-service/benches/and_then.rs +++ b/actix-service/benches/and_then.rs @@ -293,9 +293,8 @@ where let start = std::time::Instant::now(); // benchmark body rt.block_on(async move { join_all(srvs.iter_mut().map(|srv| srv.call(()))).await }); - let elapsed = start.elapsed(); // check that at least first request succeeded - elapsed + start.elapsed() }) }); } diff --git a/actix-service/benches/unsafecell_vs_refcell.rs b/actix-service/benches/unsafecell_vs_refcell.rs index 9746cf9e..a599795f 100644 --- a/actix-service/benches/unsafecell_vs_refcell.rs +++ b/actix-service/benches/unsafecell_vs_refcell.rs @@ -95,9 +95,8 @@ where let start = std::time::Instant::now(); // benchmark body rt.block_on(async move { join_all(srvs.iter_mut().map(|srv| srv.call(()))).await }); - let elapsed = start.elapsed(); // check that at least first request succeeded - elapsed + start.elapsed() }) }); } From a5a6b6704c636623737734b7730d2d940db756b5 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Sun, 9 Aug 2020 16:10:58 +0100 Subject: [PATCH 6/9] prepare actix-service 1.0.6 release (#175) --- actix-service/CHANGES.md | 5 ++- actix-service/Cargo.toml | 9 ++--- actix-service/README.md | 7 ++++ actix-service/src/fn_service.rs | 2 +- actix-service/src/lib.rs | 64 +++++++++++++++++---------------- 5 files changed, 50 insertions(+), 37 deletions(-) create mode 100644 actix-service/README.md diff --git a/actix-service/CHANGES.md b/actix-service/CHANGES.md index e7c1fefa..011ac65e 100644 --- a/actix-service/CHANGES.md +++ b/actix-service/CHANGES.md @@ -1,6 +1,9 @@ # Changes -## Unreleased +## Unreleased - 2020-xx-xx + + +## 1.0.6 - 2020-08-09 ### Fixed diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index 8ab0a05b..f88e2fb5 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "actix-service" -version = "1.0.5" +version = "1.0.6" authors = ["Nikolay Kim "] -description = "Actix service" -keywords = ["network", "framework", "async", "futures"] +description = "Service trait and combinators for representing asynchronous request/response operations." +keywords = ["network", "framework", "async", "futures", "service"] homepage = "https://actix.rs" repository = "https://github.com/actix/actix-net.git" -documentation = "https://docs.rs/actix-service/" +documentation = "https://docs.rs/actix-service" +readme = "actix-service/README.md" categories = ["network-programming", "asynchronous"] license = "MIT OR Apache-2.0" edition = "2018" diff --git a/actix-service/README.md b/actix-service/README.md new file mode 100644 index 00000000..29ca42ea --- /dev/null +++ b/actix-service/README.md @@ -0,0 +1,7 @@ +# actix-service + +> Service trait and combinators for representing asynchronous request/response operations. + +See documentation for detailed explanations these components: [https://docs.rs/actix-service](docs). + +[docs]: https://docs.rs/actix-service diff --git a/actix-service/src/fn_service.rs b/actix-service/src/fn_service.rs index 225e56b9..08690a5d 100644 --- a/actix-service/src/fn_service.rs +++ b/actix-service/src/fn_service.rs @@ -29,7 +29,7 @@ where /// /// Service that divides two usize values. /// async fn div((x, y): (usize, usize)) -> Result { /// if y == 0 { -/// Err(io::Error::new(io::ErrorKind::Other, "divide by zdro")) +/// Err(io::Error::new(io::ErrorKind::Other, "divide by zero")) /// } else { /// Ok(x / y) /// } diff --git a/actix-service/src/lib.rs b/actix-service/src/lib.rs index e1493ac1..fd09184c 100644 --- a/actix-service/src/lib.rs +++ b/actix-service/src/lib.rs @@ -1,3 +1,5 @@ +//! See [`Service`](trait.Service.html) docs for information on this crate's foundational trait. + #![deny(rust_2018_idioms, warnings)] #![allow(clippy::type_complexity)] @@ -29,21 +31,23 @@ pub use self::map_config::{map_config, unit_config}; pub use self::pipeline::{pipeline, pipeline_factory, Pipeline, PipelineFactory}; pub use self::transform::{apply, Transform}; -/// An asynchronous function from `Request` to a `Response`. +/// An asynchronous operation from `Request` to a `Response`. /// -/// `Service` represents a service that represanting interation, taking requests and giving back -/// replies. You can think about service as a function with one argument and result as a return -/// type. In general form it looks like `async fn(Req) -> Result`. `Service` -/// trait just generalizing form of this function. Each parameter described as an assotiated type. +/// The `Service` trait models a request/response interaction, receiving requests and returning +/// replies. You can think about a service as a function with one argument that returns some result +/// asynchronously. Conceptually, the operation looks like this: /// -/// Services provides a symmetric and uniform API, same abstractions represents -/// clients and servers. Services describe only `transforamtion` operation -/// which encorouge to simplify api surface and phrases `value transformation`. -/// That leads to simplier design of each service. That also allows better testability -/// and better composition. +/// ```rust,ignore +/// async fn(Request) -> Result +/// ``` /// -/// Services could be represented in several different forms. In general, -/// Service is a type that implements `Service` trait. +/// The `Service` trait just generalizes this form where each parameter is described as an +/// associated type on the trait. Services can also have mutable state that influence computation. +/// +/// `Service` provides a symmetric and uniform API; the same abstractions can be used to represent +/// both clients and servers. Services describe only _transformation_ operations which encourage +/// simple API surfaces. This leads to simpler design of each service, improves test-ability and +/// makes composition easier. /// /// ```rust,ignore /// struct MyService; @@ -60,8 +64,8 @@ pub use self::transform::{apply, Transform}; /// } /// ``` /// -/// Service can have mutable state that influence computation. -/// This service could be rewritten as a simple function: +/// Sometimes it is not necessary to implement the Service trait. For example, the above service +/// could be rewritten as a simple function and passed to [fn_service](fn.fn_service.html). /// /// ```rust,ignore /// async fn my_service(req: u8) -> Result; @@ -89,11 +93,9 @@ pub trait Service { /// It is permitted for the service to return `Ready` from a `poll_ready` /// call and the next invocation of `call` results in an error. /// - /// There are several notes to consider: - /// + /// # Notes /// 1. `.poll_ready()` might be called on different task from actual service call. - /// - /// 2. In case of chained services, `.poll_ready()` get called for all services at once. + /// 1. In case of chained services, `.poll_ready()` get called for all services at once. fn poll_ready(&mut self, ctx: &mut task::Context<'_>) -> Poll>; /// Process the request and return the response asynchronously. @@ -127,7 +129,7 @@ pub trait Service { /// Map this service's error to a different error, returning a new service. /// /// This function is similar to the `Result::map_err` where it will change - /// the error type of the underlying service. This is useful for example to + /// the error type of the underlying service. For example, this can be useful to /// ensure that services have the same error type. /// /// Note that this function consumes the receiving service and returns a @@ -141,42 +143,42 @@ pub trait Service { } } -/// Creates new `Service` values. +/// Factory for creating `Service`s. /// -/// Acts as a service factory. This is useful for cases where new `Service` -/// values must be produced. One case is a TCP server listener. The listener -/// accepts new TCP streams, obtains a new `Service` value using the -/// `ServiceFactory` trait, and uses that new `Service` value to process inbound +/// Acts as a service factory. This is useful for cases where new `Service`s +/// must be produced. One case is a TCP server listener. The listener +/// accepts new TCP streams, obtains a new `Service` using the +/// `ServiceFactory` trait, and uses the new `Service` to process inbound /// requests on that new TCP stream. /// /// `Config` is a service factory configuration type. pub trait ServiceFactory { - /// Requests handled by the service. + /// Requests handled by the created services. type Request; - /// Responses given by the service + /// Responses given by the created services. type Response; - /// Errors produced by the service + /// Errors produced by the created services. type Error; - /// Service factory configuration + /// Service factory configuration. type Config; - /// The `Service` value created by this factory + /// The kind of `Service` created by this factory. type Service: Service< Request = Self::Request, Response = Self::Response, Error = Self::Error, >; - /// Errors produced while building a service. + /// Errors potentially raised while building a service. type InitError; /// The future of the `Service` instance. type Future: Future>; - /// Create and return a new service value asynchronously. + /// Create and return a new service asynchronously. fn new_service(&self, cfg: Self::Config) -> Self::Future; /// Map this service's output to a different type, returning a new service From 5d28be9ad6428405b98f02c789544db41e7543e6 Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Tue, 11 Aug 2020 12:20:09 +0100 Subject: [PATCH 7/9] fix actix-service readme reference (#176) --- actix-service/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix-service/Cargo.toml b/actix-service/Cargo.toml index f88e2fb5..7c73e9bf 100644 --- a/actix-service/Cargo.toml +++ b/actix-service/Cargo.toml @@ -7,7 +7,7 @@ keywords = ["network", "framework", "async", "futures", "service"] homepage = "https://actix.rs" repository = "https://github.com/actix/actix-net.git" documentation = "https://docs.rs/actix-service" -readme = "actix-service/README.md" +readme = "README.md" categories = ["network-programming", "asynchronous"] license = "MIT OR Apache-2.0" edition = "2018" From fb098536ee41f642a47248525f442b4bc8173c7a Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 17 Aug 2020 15:37:57 +0100 Subject: [PATCH 8/9] bump MSRV to 1.42 (#180) --- .github/workflows/linux.yml | 2 +- README.md | 4 ++-- actix-server/src/builder.rs | 4 ++-- actix-utils/src/timeout.rs | 5 +---- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 835d0d42..3e77e990 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: version: - - 1.39.0 + - 1.42.0 - stable - nightly diff --git a/README.md b/README.md index b291fd13..827f937f 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ Actix net - framework for composable network services ## Documentation & community resources -* [Chat on gitter](https://gitter.im/actix/actix) -* Minimum supported Rust version: 1.39 or later +* [Chat on Gitter](https://gitter.im/actix/actix) +* Minimum supported Rust version: 1.42 or later ## Example diff --git a/actix-server/src/builder.rs b/actix-server/src/builder.rs index 2e8ae30e..f3f6ad86 100644 --- a/actix-server/src/builder.rs +++ b/actix-server/src/builder.rs @@ -276,7 +276,7 @@ impl ServerBuilder { info!("Starting \"{}\" service on {}", sock.1, sock.2); } self.accept.start( - mem::replace(&mut self.sockets, Vec::new()) + mem::take(&mut self.sockets) .into_iter() .map(|t| (t.0, t.2)) .collect(), @@ -355,7 +355,7 @@ impl ServerBuilder { // stop accept thread self.accept.send(Command::Stop); - let notify = std::mem::replace(&mut self.notify, Vec::new()); + let notify = std::mem::take(&mut self.notify); // stop workers if !self.workers.is_empty() && graceful { diff --git a/actix-utils/src/timeout.rs b/actix-utils/src/timeout.rs index 83fbb84f..818e6d26 100644 --- a/actix-utils/src/timeout.rs +++ b/actix-utils/src/timeout.rs @@ -58,10 +58,7 @@ impl PartialEq for TimeoutError { TimeoutError::Service(e2) => e1 == e2, TimeoutError::Timeout => false, }, - TimeoutError::Timeout => match other { - TimeoutError::Service(_) => false, - TimeoutError::Timeout => true, - }, + TimeoutError::Timeout => matches!(other, TimeoutError::Timeout), } } } From 578a5608537884bc3bd212e0af5d62136e27d9ff Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 17 Aug 2020 23:39:17 +0900 Subject: [PATCH 9/9] connect,tls: Bump up to next alpha versions (#181) --- actix-connect/CHANGES.md | 6 +++++- actix-connect/Cargo.toml | 2 +- actix-tls/CHANGES.md | 6 +++++- actix-tls/Cargo.toml | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/actix-connect/CHANGES.md b/actix-connect/CHANGES.md index d921acac..dd829518 100644 --- a/actix-connect/CHANGES.md +++ b/actix-connect/CHANGES.md @@ -1,12 +1,16 @@ # Changes -## [unreleased] +## Unreleased + + +## 2.0.0-alpha.4 - 2020-08-17 ### Changed * Update `rustls` dependency to 0.18 * Update `tokio-rustls` dependency to 0.14 + ## [2.0.0-alpha.3] - 2020-05-08 ### Fixed diff --git a/actix-connect/Cargo.toml b/actix-connect/Cargo.toml index 617421b4..89ad67be 100644 --- a/actix-connect/Cargo.toml +++ b/actix-connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-connect" -version = "2.0.0-alpha.3" +version = "2.0.0-alpha.4" authors = ["Nikolay Kim "] description = "Actix connect - tcp connector service" keywords = ["network", "framework", "async", "futures"] diff --git a/actix-tls/CHANGES.md b/actix-tls/CHANGES.md index b0d9ad28..d8badb42 100644 --- a/actix-tls/CHANGES.md +++ b/actix-tls/CHANGES.md @@ -1,6 +1,9 @@ # Changes -## [unreleased] +## Unreleased + + +## 2.0.0-alpha.2 - 2020-08-17 ### Changed @@ -8,6 +11,7 @@ * Update `tokio-rustls` dependency to 0.14 * Update `webpki-roots` dependency to 0.20 + ## [2.0.0-alpha.1] - 2020-03-03 ### Changed diff --git a/actix-tls/Cargo.toml b/actix-tls/Cargo.toml index 99be200d..34adad2c 100644 --- a/actix-tls/Cargo.toml +++ b/actix-tls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "actix-tls" -version = "2.0.0-alpha.1" +version = "2.0.0-alpha.2" authors = ["Nikolay Kim "] description = "Actix tls services" keywords = ["network", "framework", "async", "futures"]