mirror of
https://github.com/fafhrd91/actix-net
synced 2025-08-30 22:20:20 +02:00
Compare commits
43 Commits
rt-v2.10.0
...
bytestring
Author | SHA1 | Date | |
---|---|---|---|
|
0e36c5f5c4 | ||
|
47f0017899 | ||
|
bb4fc31461 | ||
|
01a104eb82 | ||
|
4ab27bfc4a | ||
|
8084cec705 | ||
|
a2517da225 | ||
|
a4b6943ddc | ||
|
7d24196d5c | ||
|
582edf5444 | ||
|
57485f1a21 | ||
|
e8871d0d06 | ||
|
83e896a6e5 | ||
|
af00dada5c | ||
|
0681b515de | ||
|
3672137d17 | ||
|
fad1fda194 | ||
|
cfae737314 | ||
|
4583daa3c2 | ||
|
b1cbacc7f6 | ||
|
77588aba81 | ||
|
aad3a48edd | ||
|
97e8c571cf | ||
|
0d8c7e5085 | ||
|
baf1b6042a | ||
|
779fa28bd5 | ||
|
e282811d69 | ||
|
5c44115978 | ||
|
ead0e2b200 | ||
|
ace737fc4c | ||
|
c45ae294fb | ||
|
939377f6ab | ||
|
20149f957b | ||
|
544e5d3b40 | ||
|
d482af529c | ||
|
0030800b9a | ||
|
64fa2f8462 | ||
|
b0d1c8d193 | ||
|
46cc62c6d8 | ||
|
912daa3d0a | ||
|
aefa810496 | ||
|
2c443a7620 | ||
|
b3b1583115 |
14
.github/workflows/ci-post-merge.yml
vendored
14
.github/workflows/ci-post-merge.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: CI (master only)
|
name: CI (post-merge)
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -59,12 +59,12 @@ jobs:
|
|||||||
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
|
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install Rust (${{ matrix.version }})
|
- name: Install Rust (${{ matrix.version }})
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.version }}
|
toolchain: ${{ matrix.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
@@ -116,12 +116,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust (nightly)
|
- name: Install Rust (nightly)
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
|
||||||
- name: Install cargo-hack & cargo-minimal-versions
|
- name: Install cargo-hack & cargo-minimal-versions
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: cargo-hack,cargo-minimal-versions
|
tool: cargo-hack,cargo-minimal-versions
|
||||||
|
|
||||||
@@ -135,10 +135,10 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
|
|
||||||
- name: Install cargo-nextest
|
- name: Install cargo-nextest
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: cargo-nextest
|
tool: cargo-nextest
|
||||||
|
|
||||||
|
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -68,12 +68,12 @@ jobs:
|
|||||||
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
|
echo "RUSTFLAGS=-C target-feature=+crt-static" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Install Rust (${{ matrix.version.name }})
|
- name: Install Rust (${{ matrix.version.name }})
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
toolchain: ${{ matrix.version.version }}
|
toolchain: ${{ matrix.version.version }}
|
||||||
|
|
||||||
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
|
||||||
|
|
||||||
@@ -120,12 +120,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust (nightly)
|
- name: Install Rust (nightly)
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
|
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: just
|
tool: just
|
||||||
|
|
||||||
|
6
.github/workflows/coverage.yml
vendored
6
.github/workflows/coverage.yml
vendored
@@ -18,12 +18,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
components: llvm-tools-preview
|
components: llvm-tools-preview
|
||||||
|
|
||||||
- name: Install cargo-llvm-cov
|
- name: Install cargo-llvm-cov
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: cargo-llvm-cov
|
tool: cargo-llvm-cov
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json
|
run: cargo llvm-cov --workspace --all-features --codecov --output-path codecov.json
|
||||||
|
|
||||||
- name: Upload coverage to Codecov
|
- name: Upload coverage to Codecov
|
||||||
uses: codecov/codecov-action@v4.4.1
|
uses: codecov/codecov-action@v5.0.2
|
||||||
with:
|
with:
|
||||||
files: codecov.json
|
files: codecov.json
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
49
.github/workflows/lint.yml
vendored
49
.github/workflows/lint.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
- uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
components: rustfmt
|
components: rustfmt
|
||||||
@@ -35,34 +35,63 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
- uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with: { components: clippy }
|
with: { components: clippy }
|
||||||
|
|
||||||
- uses: giraffate/clippy-action@v1.0.1
|
- uses: giraffate/clippy-action@v1.0.1
|
||||||
with:
|
with:
|
||||||
reporter: 'github-pr-check'
|
reporter: "github-pr-check"
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
clippy_flags: --workspace --all-features --tests --examples --bins -- -Dclippy::todo -Aunknown_lints
|
clippy_flags: --workspace --all-features --tests --examples --bins -- -Dclippy::todo -Aunknown_lints
|
||||||
|
|
||||||
check-external-types:
|
check-external-types:
|
||||||
|
if: false # rustdoc mismatch currently
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust (nightly-2023-10-10)
|
- name: Install Rust (${{ vars.RUST_VERSION_EXTERNAL_TYPES }})
|
||||||
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
|
||||||
with:
|
with:
|
||||||
toolchain: nightly-2023-10-10
|
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
||||||
|
|
||||||
- name: Install just
|
- name: Install just
|
||||||
uses: taiki-e/install-action@v2.34.1
|
uses: taiki-e/install-action@v2.44.71
|
||||||
with:
|
with:
|
||||||
tool: just
|
tool: just
|
||||||
|
|
||||||
- name: Install cargo-check-external-types
|
- name: Install cargo-check-external-types
|
||||||
uses: taiki-e/cache-cargo-install-action@v2.0.0
|
uses: taiki-e/cache-cargo-install-action@v2.0.1
|
||||||
with:
|
with:
|
||||||
tool: cargo-check-external-types@0.1.10
|
tool: cargo-check-external-types
|
||||||
|
|
||||||
- name: check external types
|
- name: check external types
|
||||||
run: just check-external-types-all +nightly-2023-10-10
|
run: just check-external-types-all +${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
|
||||||
|
|
||||||
|
public-api-diff:
|
||||||
|
name: Public API Diff
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout main branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.base_ref }}
|
||||||
|
|
||||||
|
- name: Checkout PR branch
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust (${{ vars.RUST_VERSION_API_DIFF }})
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
||||||
|
with:
|
||||||
|
toolchain: ${{ vars.RUST_VERSION_API_DIFF }}
|
||||||
|
|
||||||
|
- name: Install cargo-public-api
|
||||||
|
uses: taiki-e/install-action@v2.34.0
|
||||||
|
with:
|
||||||
|
tool: cargo-public-api
|
||||||
|
|
||||||
|
- name: Generate API diff
|
||||||
|
run: |
|
||||||
|
for f in $(find -mindepth 2 -maxdepth 2 -name Cargo.toml); do
|
||||||
|
cargo public-api --manifest-path "$f" --simplified diff ${{ github.event.pull_request.base.sha }}..${{ github.sha }}
|
||||||
|
done
|
||||||
|
36
.github/workflows/upload-doc.yml
vendored
36
.github/workflows/upload-doc.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: Upload documentation
|
|
||||||
|
|
||||||
on:
|
|
||||||
push: { branches: [master] }
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
|
|
||||||
with: { toolchain: nightly }
|
|
||||||
|
|
||||||
- name: Build Docs
|
|
||||||
run: cargo doc --workspace --all-features --no-deps
|
|
||||||
|
|
||||||
- name: Tweak HTML
|
|
||||||
run: echo '<meta http-equiv="refresh" content="0;url=actix_server/index.html">' > target/doc/index.html
|
|
||||||
|
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
uses: JamesIves/github-pages-deploy-action@v4.6.1
|
|
||||||
with:
|
|
||||||
folder: target/doc
|
|
||||||
single-commit: true
|
|
4
.gitignore
vendored
4
.gitignore
vendored
@@ -13,4 +13,8 @@ guide/build/
|
|||||||
# These are backup files generated by rustfmt
|
# These are backup files generated by rustfmt
|
||||||
**/*.rs.bk
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# IDEs
|
||||||
.idea
|
.idea
|
||||||
|
|
||||||
|
# direnv
|
||||||
|
/.direnv
|
||||||
|
@@ -17,7 +17,7 @@ members = [
|
|||||||
[workspace.package]
|
[workspace.package]
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.70"
|
rust-version = "1.71.1"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
actix-codec = { path = "actix-codec" }
|
actix-codec = { path = "actix-codec" }
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 0.5.2
|
## 0.5.2
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 0.2.4
|
## 0.2.4
|
||||||
|
|
||||||
|
@@ -32,5 +32,5 @@ proc-macro2 = "1.0.60"
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
actix-rt = "2"
|
actix-rt = "2"
|
||||||
futures-util = { version = "0.3.17", default-features = false }
|
futures-util = { version = "0.3.17", default-features = false }
|
||||||
rustversion-msrv = "0.99"
|
rustversion-msrv = "0.100"
|
||||||
trybuild = "1"
|
trybuild = "1"
|
||||||
|
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 2.10.0
|
## 2.10.0
|
||||||
|
|
||||||
- Relax bound (`F: Fn -> FnOnce`) on `{Arbiter, System}::with_tokio_rt()` functions.
|
- Relax `F`'s bound (`Fn => FnOnce`) on `{Arbiter, System}::with_tokio_rt()` functions.
|
||||||
- Update `tokio-uring` dependency to `0.5`.
|
- Update `tokio-uring` dependency to `0.5`.
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.70.
|
||||||
|
|
||||||
|
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
|
## 2.5.0
|
||||||
|
|
||||||
|
- Update `mio` dependency to `1`.
|
||||||
|
|
||||||
## 2.4.0
|
## 2.4.0
|
||||||
|
|
||||||
- Update `tokio-uring` dependency to `0.5`.
|
- Update `tokio-uring` dependency to `0.5`.
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "actix-server"
|
name = "actix-server"
|
||||||
version = "2.4.0"
|
version = "2.5.0"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
@@ -31,7 +31,7 @@ actix-utils = "3"
|
|||||||
|
|
||||||
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
futures-core = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||||
futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
futures-util = { version = "0.3.17", default-features = false, features = ["alloc"] }
|
||||||
mio = { version = "0.8", features = ["os-poll", "net"] }
|
mio = { version = "1", features = ["os-poll", "net"] }
|
||||||
socket2 = "0.5"
|
socket2 = "0.5"
|
||||||
tokio = { version = "1.23.1", features = ["sync"] }
|
tokio = { version = "1.23.1", features = ["sync"] }
|
||||||
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
tracing = { version = "0.1.30", default-features = false, features = ["log"] }
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
|
|
||||||
[](https://crates.io/crates/actix-server)
|
[](https://crates.io/crates/actix-server)
|
||||||
[](https://docs.rs/actix-server/2.4.0)
|
[](https://docs.rs/actix-server/2.5.0)
|
||||||
[](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
[](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
||||||

|

|
||||||
<br />
|
<br />
|
||||||
[](https://deps.rs/crate/actix-server/2.4.0)
|
[](https://deps.rs/crate/actix-server/2.5.0)
|
||||||

|

|
||||||
[](https://discord.gg/NWpN5mmg3x)
|
[](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
@@ -183,11 +183,6 @@ impl ServerInner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run_sync(mut builder: ServerBuilder) -> io::Result<(Self, ServerEventMultiplexer)> {
|
fn run_sync(mut builder: ServerBuilder) -> io::Result<(Self, ServerEventMultiplexer)> {
|
||||||
let sockets = mem::take(&mut builder.sockets)
|
|
||||||
.into_iter()
|
|
||||||
.map(|t| (t.0, t.2))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// Give log information on what runtime will be used.
|
// Give log information on what runtime will be used.
|
||||||
let is_actix = actix_rt::System::try_current().is_some();
|
let is_actix = actix_rt::System::try_current().is_some();
|
||||||
let is_tokio = tokio::runtime::Handle::try_current().is_ok();
|
let is_tokio = tokio::runtime::Handle::try_current().is_ok();
|
||||||
@@ -207,6 +202,11 @@ impl ServerInner {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let sockets = mem::take(&mut builder.sockets)
|
||||||
|
.into_iter()
|
||||||
|
.map(|t| (t.0, t.2))
|
||||||
|
.collect();
|
||||||
|
|
||||||
let (waker_queue, worker_handles, accept_handle) = Accept::start(sockets, &builder)?;
|
let (waker_queue, worker_handles, accept_handle) = Accept::start(sockets, &builder)?;
|
||||||
|
|
||||||
let mux = ServerEventMultiplexer {
|
let mux = ServerEventMultiplexer {
|
||||||
|
@@ -126,7 +126,7 @@ pub(crate) enum SocketAddr {
|
|||||||
Unknown,
|
Unknown,
|
||||||
Tcp(StdSocketAddr),
|
Tcp(StdSocketAddr),
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
Uds(mio::net::SocketAddr),
|
Uds(std::os::unix::net::SocketAddr),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for SocketAddr {
|
impl fmt::Display for SocketAddr {
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 2.0.2
|
## 2.0.2
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ pub trait ServiceExt<Req>: Service<Req> {
|
|||||||
/// Call another service after call to this one has resolved successfully.
|
/// Call another service after call to this one has resolved successfully.
|
||||||
///
|
///
|
||||||
/// This function can be used to chain two services together and ensure that the second service
|
/// This function can be used to chain two services together and ensure that the second service
|
||||||
/// isn't called until call to the fist service have finished. Result of the call to the first
|
/// isn't called until call to the first service have finished. Result of the call to the first
|
||||||
/// service is used as an input parameter for the second service's call.
|
/// service is used as an input parameter for the second service's call.
|
||||||
///
|
///
|
||||||
/// Note that this function consumes the receiving service and returns a wrapped version of it.
|
/// Note that this function consumes the receiving service and returns a wrapped version of it.
|
||||||
|
@@ -52,7 +52,7 @@ where
|
|||||||
/// Call another service after call to this one has resolved successfully.
|
/// Call another service after call to this one has resolved successfully.
|
||||||
///
|
///
|
||||||
/// This function can be used to chain two services together and ensure that
|
/// This function can be used to chain two services together and ensure that
|
||||||
/// the second service isn't called until call to the fist service have
|
/// the second service isn't called until call to the first service have
|
||||||
/// finished. Result of the call to the first service is used as an
|
/// finished. Result of the call to the first service is used as an
|
||||||
/// input parameter for the second service's call.
|
/// input parameter for the second service's call.
|
||||||
///
|
///
|
||||||
|
@@ -228,6 +228,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
// pseudo-doctest for Transform trait
|
// pseudo-doctest for Transform trait
|
||||||
|
#[allow(unused)]
|
||||||
pub struct TimeoutTransform {
|
pub struct TimeoutTransform {
|
||||||
timeout: Duration,
|
timeout: Duration,
|
||||||
}
|
}
|
||||||
@@ -249,6 +250,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pseudo-doctest for Transform trait
|
// pseudo-doctest for Transform trait
|
||||||
|
#[allow(unused)]
|
||||||
pub struct Timeout<S> {
|
pub struct Timeout<S> {
|
||||||
service: S,
|
service: S,
|
||||||
_timeout: Duration,
|
_timeout: Duration,
|
||||||
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 3.4.0
|
## 3.4.0
|
||||||
|
|
||||||
- Add `rustls-0_23`, `rustls-0_23-webpki-roots`, and `rustls-0_23-native-roots` crate features.
|
- Add `rustls-0_23`, `rustls-0_23-webpki-roots`, and `rustls-0_23-native-roots` crate features.
|
||||||
|
@@ -131,7 +131,7 @@ bytes = "1"
|
|||||||
pretty_env_logger = "0.5"
|
pretty_env_logger = "0.5"
|
||||||
futures-util = { version = "0.3.17", default-features = false, features = ["sink"] }
|
futures-util = { version = "0.3.17", default-features = false, features = ["sink"] }
|
||||||
itertools = "0.13"
|
itertools = "0.13"
|
||||||
rcgen = "0.12"
|
rcgen = "0.13"
|
||||||
rustls-pemfile = "2"
|
rustls-pemfile = "2"
|
||||||
tokio-rustls-026 = { package = "tokio-rustls", version = "0.26" }
|
tokio-rustls-026 = { package = "tokio-rustls", version = "0.26" }
|
||||||
trust-dns-resolver = "0.23"
|
trust-dns-resolver = "0.23"
|
||||||
|
@@ -21,12 +21,12 @@ use rustls_pki_types_1::ServerName;
|
|||||||
use tokio_rustls_026::rustls::RootCertStore;
|
use tokio_rustls_026::rustls::RootCertStore;
|
||||||
|
|
||||||
fn new_cert_and_key() -> (String, String) {
|
fn new_cert_and_key() -> (String, String) {
|
||||||
let cert =
|
let rcgen::CertifiedKey { cert, key_pair } =
|
||||||
rcgen::generate_simple_self_signed(vec!["127.0.0.1".to_owned(), "localhost".to_owned()])
|
rcgen::generate_simple_self_signed(vec!["127.0.0.1".to_owned(), "localhost".to_owned()])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let key = cert.serialize_private_key_pem();
|
let key = key_pair.serialize_pem();
|
||||||
let cert = cert.serialize_pem().unwrap();
|
let cert = cert.pem();
|
||||||
|
|
||||||
(cert, key)
|
(cert, key)
|
||||||
}
|
}
|
||||||
|
@@ -24,12 +24,12 @@ use rustls_pki_types_1::PrivateKeyDer;
|
|||||||
use tls_openssl::ssl::SslVerifyMode;
|
use tls_openssl::ssl::SslVerifyMode;
|
||||||
|
|
||||||
fn new_cert_and_key() -> (String, String) {
|
fn new_cert_and_key() -> (String, String) {
|
||||||
let cert =
|
let rcgen::CertifiedKey { cert, key_pair } =
|
||||||
rcgen::generate_simple_self_signed(vec!["127.0.0.1".to_owned(), "localhost".to_owned()])
|
rcgen::generate_simple_self_signed(vec!["127.0.0.1".to_owned(), "localhost".to_owned()])
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let key = cert.serialize_private_key_pem();
|
let key = key_pair.serialize_pem();
|
||||||
let cert = cert.serialize_pem().unwrap();
|
let cert = cert.pem();
|
||||||
|
|
||||||
(cert, key)
|
(cert, key)
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 3.0.1
|
## 3.0.1
|
||||||
|
|
||||||
|
@@ -2,7 +2,10 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
## 1.4.0
|
||||||
|
|
||||||
|
- Add `ByteString::split_at()` method.
|
||||||
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 1.3.1
|
## 1.3.1
|
||||||
|
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "bytestring"
|
name = "bytestring"
|
||||||
version = "1.3.1"
|
version = "1.4.0"
|
||||||
description = "A UTF-8 encoded read-only string using `Bytes` as storage"
|
description = "A UTF-8 encoded read-only string using `Bytes` as storage"
|
||||||
authors = [
|
authors = [
|
||||||
"Nikolay Kim <fafhrd91@gmail.com>",
|
"Nikolay Kim <fafhrd91@gmail.com>",
|
||||||
"Rob Ede <robjtede@icloud.com>",
|
"Rob Ede <robjtede@icloud.com>",
|
||||||
]
|
]
|
||||||
keywords = ["string", "bytes", "utf8", "web", "actix"]
|
keywords = ["string", "bytes", "utf8", "web", "bytestring"]
|
||||||
categories = ["no-std", "web-programming"]
|
categories = ["no-std", "web-programming"]
|
||||||
homepage = "https://actix.rs"
|
homepage = "https://actix.rs"
|
||||||
repository = "https://github.com/actix/actix-net"
|
repository = "https://github.com/actix/actix-net"
|
||||||
@@ -22,9 +22,9 @@ allowed_external_types = [
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bytes = { version = "1.2", default-features = false }
|
bytes = { version = "1.2", default-features = false }
|
||||||
serde = { version = "1.0", optional = true }
|
serde = { version = "1", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
ahash = { version = "0.8", default-features = false }
|
ahash = { version = "0.8", default-features = false }
|
||||||
serde_json = "1.0"
|
serde_json = "1"
|
||||||
static_assertions = "1.1"
|
static_assertions = "1.1"
|
||||||
|
@@ -5,11 +5,11 @@
|
|||||||
<!-- prettier-ignore-start -->
|
<!-- prettier-ignore-start -->
|
||||||
|
|
||||||
[](https://crates.io/crates/bytestring)
|
[](https://crates.io/crates/bytestring)
|
||||||
[](https://docs.rs/bytestring/1.3.1)
|
[](https://docs.rs/bytestring/1.4.0)
|
||||||
[](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
[](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
|
||||||

|

|
||||||
<br />
|
<br />
|
||||||
[](https://deps.rs/crate/bytestring/1.3.1)
|
[](https://deps.rs/crate/bytestring/1.4.0)
|
||||||

|

|
||||||
[](https://discord.gg/NWpN5mmg3x)
|
[](https://discord.gg/NWpN5mmg3x)
|
||||||
|
|
||||||
|
@@ -17,7 +17,7 @@ use core::{borrow::Borrow, fmt, hash, ops, str};
|
|||||||
|
|
||||||
use bytes::Bytes;
|
use bytes::Bytes;
|
||||||
|
|
||||||
/// An immutable UTF-8 encoded string with [`Bytes`] as a storage.
|
/// An immutable UTF-8 encoded string using [`Bytes`] as the storage.
|
||||||
#[derive(Clone, Default, Eq, PartialOrd, Ord)]
|
#[derive(Clone, Default, Eq, PartialOrd, Ord)]
|
||||||
pub struct ByteString(Bytes);
|
pub struct ByteString(Bytes);
|
||||||
|
|
||||||
@@ -53,7 +53,29 @@ impl ByteString {
|
|||||||
Self(src)
|
Self(src)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a new byte string that is equivalent to the given `subset`.
|
/// Divides one bytestring into two at an index, returning both parts.
|
||||||
|
///
|
||||||
|
/// # Panics
|
||||||
|
///
|
||||||
|
/// Panics if `mid` is not on a UTF-8 code point boundary, or if it is past the end of the last
|
||||||
|
/// code point of the bytestring.
|
||||||
|
pub fn split_at(&self, mid: usize) -> (ByteString, ByteString) {
|
||||||
|
let this: &str = self.as_ref();
|
||||||
|
let _valid_midpoint_check = this.split_at(mid);
|
||||||
|
|
||||||
|
let mut bytes = self.0.clone();
|
||||||
|
let first = bytes.split_to(mid);
|
||||||
|
let last = bytes;
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
(
|
||||||
|
ByteString::from_bytes_unchecked(first),
|
||||||
|
ByteString::from_bytes_unchecked(last),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a new `ByteString` that is equivalent to the given `subset`.
|
||||||
///
|
///
|
||||||
/// When processing a `ByteString` buffer with other tools, one often gets a `&str` which is in
|
/// When processing a `ByteString` buffer with other tools, one often gets a `&str` which is in
|
||||||
/// fact a slice of the original `ByteString`; i.e., a subset of it. This function turns that
|
/// fact a slice of the original `ByteString`; i.e., a subset of it. This function turns that
|
||||||
@@ -465,4 +487,33 @@ mod test {
|
|||||||
// being a logical subset of the string
|
// being a logical subset of the string
|
||||||
ByteString::from_static("foo bar").slice_ref("foo");
|
ByteString::from_static("foo bar").slice_ref("foo");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn split_at() {
|
||||||
|
let buf = ByteString::from_static("foo bar");
|
||||||
|
|
||||||
|
let (first, last) = buf.split_at(0);
|
||||||
|
assert_eq!(ByteString::from_static(""), first);
|
||||||
|
assert_eq!(ByteString::from_static("foo bar"), last);
|
||||||
|
|
||||||
|
let (first, last) = buf.split_at(4);
|
||||||
|
assert_eq!(ByteString::from_static("foo "), first);
|
||||||
|
assert_eq!(ByteString::from_static("bar"), last);
|
||||||
|
|
||||||
|
let (first, last) = buf.split_at(7);
|
||||||
|
assert_eq!(ByteString::from_static("foo bar"), first);
|
||||||
|
assert_eq!(ByteString::from_static(""), last);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic = "byte index 1 is not a char boundary;"]
|
||||||
|
fn split_at_invalid_code_point() {
|
||||||
|
ByteString::from_static("µ").split_at(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
#[should_panic = "byte index 9 is out of bounds"]
|
||||||
|
fn split_at_outside_string() {
|
||||||
|
ByteString::from_static("foo").split_at(9);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ coverage:
|
|||||||
default:
|
default:
|
||||||
threshold: 10% # make CI green
|
threshold: 10% # make CI green
|
||||||
|
|
||||||
ignore: # ignore codecoverage on following paths
|
ignore: # ignore code coverage on following paths
|
||||||
- "examples"
|
- "examples"
|
||||||
- ".github"
|
- ".github"
|
||||||
- "**/*.md"
|
- "**/*.md"
|
||||||
|
58
flake.lock
generated
Normal file
58
flake.lock
generated
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"flake-parts": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1715865404,
|
||||||
|
"narHash": "sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "8dc45382d5206bd292f9c2768b8058a8fd8311d9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1722651103,
|
||||||
|
"narHash": "sha256-IRiJA0NVAoyaZeKZluwfb2DoTpBAj+FLI0KfybBeDU0=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "a633d89c6dc9a2a8aae11813a62d7c58b2c0cc51",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-24.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1714640452,
|
||||||
|
"narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=",
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "tarball",
|
||||||
|
"url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-parts": "flake-parts",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
30
flake.nix
Normal file
30
flake.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
|
||||||
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs@{ flake-parts, ... }:
|
||||||
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
|
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||||
|
perSystem = { pkgs, config, inputs', system, lib, ... }: {
|
||||||
|
formatter = pkgs.nixpkgs-fmt;
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
packages = [
|
||||||
|
config.formatter
|
||||||
|
pkgs.fd
|
||||||
|
pkgs.just
|
||||||
|
pkgs.nodePackages.prettier
|
||||||
|
pkgs.taplo
|
||||||
|
pkgs.watchexec
|
||||||
|
] ++ lib.optional pkgs.stdenv.isDarwin [
|
||||||
|
pkgs.pkgsBuildHost.darwin.apple_sdk.frameworks.Security
|
||||||
|
pkgs.pkgsBuildHost.darwin.apple_sdk.frameworks.CoreFoundation
|
||||||
|
pkgs.pkgsBuildHost.darwin.apple_sdk.frameworks.SystemConfiguration
|
||||||
|
pkgs.pkgsBuildHost.libiconv
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
28
justfile
28
justfile
@@ -1,6 +1,23 @@
|
|||||||
_list:
|
_list:
|
||||||
@just --list
|
@just --list
|
||||||
|
|
||||||
|
# Check project.
|
||||||
|
check: && clippy
|
||||||
|
just --unstable --fmt --check
|
||||||
|
# nixpkgs-fmt --check .
|
||||||
|
fd --hidden --type=file -e=md -e=yml --exec-batch prettier --check
|
||||||
|
fd --hidden -e=toml --exec-batch taplo format --check
|
||||||
|
fd --hidden -e=toml --exec-batch taplo lint
|
||||||
|
cargo +nightly fmt -- --check
|
||||||
|
|
||||||
|
# Format project.
|
||||||
|
fmt:
|
||||||
|
just --unstable --fmt
|
||||||
|
# nixpkgs-fmt .
|
||||||
|
fd --hidden --type=file -e=md -e=yml --exec-batch prettier --write
|
||||||
|
fd --type=file --hidden -e=toml --exec-batch taplo format
|
||||||
|
cargo +nightly fmt
|
||||||
|
|
||||||
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
|
# Downgrade dev-dependencies necessary to run MSRV checks/tests.
|
||||||
[private]
|
[private]
|
||||||
downgrade-for-msrv:
|
downgrade-for-msrv:
|
||||||
@@ -12,7 +29,6 @@ msrv := ```
|
|||||||
| sed -E 's/^1\.([0-9]{2})$/1\.\1\.0/'
|
| sed -E 's/^1\.([0-9]{2})$/1\.\1\.0/'
|
||||||
```
|
```
|
||||||
msrv_rustup := "+" + msrv
|
msrv_rustup := "+" + msrv
|
||||||
|
|
||||||
non_linux_all_features_list := ```
|
non_linux_all_features_list := ```
|
||||||
cargo metadata --format-version=1 \
|
cargo metadata --format-version=1 \
|
||||||
| jq '.packages[] | select(.source == null) | .features | keys' \
|
| jq '.packages[] | select(.source == null) | .features | keys' \
|
||||||
@@ -20,19 +36,15 @@ non_linux_all_features_list := ```
|
|||||||
--arg exclusions "tokio-uring,io-uring" \
|
--arg exclusions "tokio-uring,io-uring" \
|
||||||
'add | unique | . - ($exclusions | split(",")) | join(",")'
|
'add | unique | . - ($exclusions | split(",")) | join(",")'
|
||||||
```
|
```
|
||||||
|
all_crate_features := if os() == "linux" { "--all-features" } else { "--features='" + non_linux_all_features_list + "'" }
|
||||||
all_crate_features := if os() == "linux" {
|
|
||||||
"--all-features"
|
|
||||||
} else {
|
|
||||||
"--features='" + non_linux_all_features_list + "'"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run Clippy over workspace.
|
# Run Clippy over workspace.
|
||||||
clippy toolchain="":
|
clippy toolchain="":
|
||||||
cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }}
|
cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }}
|
||||||
|
|
||||||
# Test workspace code.
|
# Test workspace code.
|
||||||
[macos, windows]
|
[macos]
|
||||||
|
[windows]
|
||||||
test toolchain="":
|
test toolchain="":
|
||||||
cargo {{ toolchain }} test --lib --tests --package=actix-macros
|
cargo {{ toolchain }} test --lib --tests --package=actix-macros
|
||||||
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros --no-default-features
|
cargo {{ toolchain }} nextest run --workspace --exclude=actix-macros --no-default-features
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 0.1.5
|
## 0.1.5
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
- Minimum supported Rust version (MSRV) is now 1.70.
|
- Minimum supported Rust version (MSRV) is now 1.71.
|
||||||
|
|
||||||
## 0.1.4
|
## 0.1.4
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user