Merge branch 'main' into patch-1

This commit is contained in:
Nur 2026-02-01 19:22:36 +06:00 committed by GitHub
commit 8ea3b14779
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
59 changed files with 162 additions and 225 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1 @@
github: [JohnTitor]

View File

@ -64,7 +64,7 @@ jobs:
toolchain: ${{ matrix.version }}
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.65.13
uses: taiki-e/install-action@v2.67.13
with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -121,7 +121,7 @@ jobs:
toolchain: nightly
- name: Install cargo-hack & cargo-minimal-versions
uses: taiki-e/install-action@v2.65.13
uses: taiki-e/install-action@v2.67.13
with:
tool: cargo-hack,cargo-minimal-versions

View File

@ -73,7 +73,7 @@ jobs:
toolchain: ${{ matrix.version.version }}
- name: Install just, cargo-hack, cargo-nextest, cargo-ci-cache-clean
uses: taiki-e/install-action@v2.65.13
uses: taiki-e/install-action@v2.67.13
with:
tool: just,cargo-hack,cargo-nextest,cargo-ci-cache-clean
@ -125,7 +125,7 @@ jobs:
toolchain: nightly
- name: Install just
uses: taiki-e/install-action@v2.65.13
uses: taiki-e/install-action@v2.67.13
with:
tool: just

View File

@ -23,7 +23,7 @@ jobs:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2.65.13
uses: taiki-e/install-action@v2.67.13
with:
tool: cargo-llvm-cov

View File

@ -56,12 +56,12 @@ jobs:
toolchain: ${{ vars.RUST_VERSION_EXTERNAL_TYPES }}
- name: Install just
uses: taiki-e/install-action@v2.65.13
uses: taiki-e/install-action@v2.67.13
with:
tool: just
- name: Install cargo-check-external-types
uses: taiki-e/cache-cargo-install-action@v3.0.0
uses: taiki-e/cache-cargo-install-action@v3.0.1
with:
tool: cargo-check-external-types

44
Cargo.lock generated
View File

@ -172,28 +172,6 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
[[package]]
name = "async-stream"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476"
dependencies = [
"async-stream-impl",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-stream-impl"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "async-trait"
version = "0.1.89"
@ -1475,9 +1453,9 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.104"
version = "1.0.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0"
checksum = "535d180e0ecab6268a3e718bb9fd44db66bbbc256257165fc699dadf70d16fe7"
dependencies = [
"unicode-ident",
]
@ -1936,9 +1914,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.148"
version = "1.0.149"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da"
checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"
dependencies = [
"itoa",
"memchr",
@ -2048,9 +2026,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]]
name = "syn"
version = "2.0.111"
version = "2.0.114"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87"
checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"
dependencies = [
"proc-macro2",
"quote",
@ -2309,12 +2287,10 @@ dependencies = [
[[package]]
name = "tokio-test"
version = "0.4.4"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7"
checksum = "3f6d24790a10a7af737693a3e8f1d03faef7e6ca0cc99aae5066f533766de545"
dependencies = [
"async-stream",
"bytes",
"futures-core",
"tokio",
"tokio-stream",
@ -2442,9 +2418,9 @@ dependencies = [
[[package]]
name = "tracing-subscriber"
version = "0.3.20"
version = "0.3.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5"
checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e"
dependencies = [
"matchers",
"nu-ansi-term",

View File

@ -19,7 +19,7 @@ homepage = "https://actix.rs"
repository = "https://github.com/actix/actix-net"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.76"
rust-version = "1.88"
[patch.crates-io]
actix-codec = { path = "actix-codec" }

View File

@ -13,7 +13,7 @@ See example folders for [`actix-server`](./actix-server/examples) and [`actix-tl
## MSRV
Crates in this repo currently have a Minimum Supported Rust Version (MSRV) of 1.65. As a policy, we permit MSRV increases in non-breaking releases.
Crates in this repo currently have a Minimum Supported Rust Version (MSRV) of 1.88. As a policy, we permit MSRV increases in non-breaking releases.
## License

View File

@ -2,7 +2,7 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
## 0.5.2

View File

@ -2,7 +2,7 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
## 0.2.4

View File

@ -2,7 +2,7 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
## 2.11.0

View File

@ -4,7 +4,7 @@
[![crates.io](https://img.shields.io/crates/v/actix-rt?label=latest)](https://crates.io/crates/actix-rt)
[![Documentation](https://docs.rs/actix-rt/badge.svg?version=2.11.0)](https://docs.rs/actix-rt/2.11.0)
[![Version](https://img.shields.io/badge/rustc-1.46+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-rt.svg)
<br />
[![dependency status](https://deps.rs/crate/actix-rt/2.11.0/status.svg)](https://deps.rs/crate/actix-rt/2.11.0)

View File

@ -2,7 +2,8 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
- internal: Use `core::future::{ready, Ready}` instead of actix-utils'
## 2.6.0

View File

@ -6,7 +6,7 @@
[![crates.io](https://img.shields.io/crates/v/actix-server?label=latest)](https://crates.io/crates/actix-server)
[![Documentation](https://docs.rs/actix-server/badge.svg?version=2.6.0)](https://docs.rs/actix-server/2.6.0)
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-server.svg)
<br />
[![Dependency Status](https://deps.rs/crate/actix-server/2.6.0/status.svg)](https://deps.rs/crate/actix-server/2.6.0)

View File

@ -63,7 +63,7 @@ impl<T> Future for JoinAll<T> {
#[cfg(test)]
mod test {
use actix_utils::future::ready;
use core::future::ready;
use super::*;

View File

@ -1,3 +1,4 @@
use core::future::{ready, Ready};
use std::{
marker::PhantomData,
net::SocketAddr,
@ -5,7 +6,6 @@ use std::{
};
use actix_service::{Service, ServiceFactory as BaseServiceFactory};
use actix_utils::future::{ready, Ready};
use futures_core::future::LocalBoxFuture;
use tracing::error;

View File

@ -2,7 +2,8 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
- internal: Use `core::future::{ready, Ready}` instead of hand-crafted one
## 2.0.3

View File

@ -4,7 +4,7 @@
[![crates.io](https://img.shields.io/crates/v/actix-service?label=latest)](https://crates.io/crates/actix-service)
[![Documentation](https://docs.rs/actix-service/badge.svg?version=2.0.3)](https://docs.rs/actix-service/2.0.3)
[![Version](https://img.shields.io/badge/rustc-1.46+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.46.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-service.svg)
[![Dependency Status](https://deps.rs/crate/actix-service/2.0.3/status.svg)](https://deps.rs/crate/actix-service/2.0.3)
![Download](https://img.shields.io/crates/d/actix-service.svg)

View File

@ -246,15 +246,16 @@ mod tests {
use alloc::rc::Rc;
use core::{
cell::Cell,
future::{ready, Ready},
task::{Context, Poll},
};
use futures_util::future::lazy;
use crate::{
fn_factory, ok,
fn_factory,
pipeline::{pipeline, pipeline_factory},
ready, Ready, Service, ServiceFactory,
Service, ServiceFactory,
};
struct Srv1(Rc<Cell<usize>>);
@ -270,7 +271,7 @@ mod tests {
}
fn call(&self, req: &'static str) -> Self::Future {
ok(req)
ready(Ok(req))
}
}
@ -288,7 +289,7 @@ mod tests {
}
fn call(&self, req: &'static str) -> Self::Future {
ok((req, "srv2"))
ready(Ok((req, "srv2")))
}
}

View File

@ -208,14 +208,12 @@ where
#[cfg(test)]
mod tests {
use core::future::{ready, Ready};
use futures_util::future::lazy;
use super::*;
use crate::{
ok,
pipeline::{pipeline, pipeline_factory},
Ready,
};
use crate::pipeline::{pipeline, pipeline_factory};
#[derive(Clone)]
struct Srv;
@ -228,7 +226,7 @@ mod tests {
crate::always_ready!();
fn call(&self, _: ()) -> Self::Future {
ok(())
ready(Ok(()))
}
}
@ -252,7 +250,7 @@ mod tests {
#[actix_rt::test]
async fn test_new_service() {
let new_srv = pipeline_factory(apply_fn_factory(
|| ok::<_, ()>(Srv),
|| ready(Ok::<_, ()>(Srv)),
|req: &'static str, srv| {
let fut = srv.call(());
async move {

View File

@ -1,6 +1,9 @@
use core::{future::Future, marker::PhantomData};
use core::{
future::{ready, Future, Ready},
marker::PhantomData,
};
use crate::{ok, IntoService, IntoServiceFactory, Ready, Service, ServiceFactory};
use crate::{IntoService, IntoServiceFactory, Service, ServiceFactory};
/// Create `ServiceFactory` for function that can act as a `Service`
pub fn fn_service<F, Fut, Req, Res, Err, Cfg>(f: F) -> FnServiceFactory<F, Fut, Req, Res, Err, Cfg>
@ -210,7 +213,7 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: Cfg) -> Self::Future {
ok(FnService::new(self.f.clone()))
ready(Ok(FnService::new(self.f.clone())))
}
}
@ -346,7 +349,7 @@ where
#[cfg(test)]
mod tests {
use core::task::Poll;
use core::{future::ready, task::Poll};
use futures_util::future::lazy;
@ -354,7 +357,7 @@ mod tests {
#[actix_rt::test]
async fn test_fn_service() {
let new_srv = fn_service(|()| ok::<_, ()>("srv"));
let new_srv = fn_service(|()| ready(Ok::<_, ()>("srv")));
let srv = new_srv.new_service(()).await.unwrap();
let res = srv.call(()).await;
@ -365,7 +368,7 @@ mod tests {
#[actix_rt::test]
async fn test_fn_service_service() {
let srv = fn_service(|()| ok::<_, ()>("srv"));
let srv = fn_service(|()| ready(Ok::<_, ()>("srv")));
let res = srv.call(()).await;
assert_eq!(lazy(|cx| srv.poll_ready(cx)).await, Poll::Ready(Ok(())));
@ -376,7 +379,9 @@ mod tests {
#[actix_rt::test]
async fn test_fn_service_with_config() {
let new_srv = fn_factory_with_config(|cfg: usize| {
ok::<_, ()>(fn_service(move |()| ok::<_, ()>(("srv", cfg))))
ready(Ok::<_, ()>(fn_service(move |()| {
ready(Ok::<_, ()>(("srv", cfg)))
})))
});
let srv = new_srv.new_service(1).await.unwrap();
@ -392,14 +397,19 @@ mod tests {
use crate::{map_config, ServiceExt, ServiceFactoryExt};
let srv_1 = fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8)));
let srv_1 = fn_service(|_: Rc<u8>| ready(Ok::<_, Rc<u8>>(Rc::new(0u8))));
let fac_1 = fn_factory_with_config(|_: Rc<u8>| {
ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8))))
ready(Ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| {
ready(Ok::<_, Rc<u8>>(Rc::new(0u8)))
})))
});
let fac_2 =
fn_factory(|| ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| ok::<_, Rc<u8>>(Rc::new(0u8)))));
let fac_2 = fn_factory(|| {
ready(Ok::<_, Rc<u8>>(fn_service(|_: Rc<u8>| {
ready(Ok::<_, Rc<u8>>(Rc::new(0u8)))
})))
});
fn is_send<T: Send + Sync + Clone>(_: &T) {}

View File

@ -26,13 +26,10 @@ mod map_config;
mod map_err;
mod map_init_err;
mod pipeline;
mod ready;
mod then;
mod transform;
mod transform_err;
#[allow(unused_imports)]
use self::ready::{err, ok, ready, Ready};
pub use self::{
apply::{apply_fn, apply_fn_factory},
apply_cfg::{apply_cfg, apply_cfg_factory},

View File

@ -199,10 +199,12 @@ where
#[cfg(test)]
mod tests {
use core::future::{ready, Ready};
use futures_util::future::lazy;
use super::*;
use crate::{ok, IntoServiceFactory, Ready, ServiceExt, ServiceFactoryExt};
use crate::{IntoServiceFactory, ServiceExt, ServiceFactoryExt};
struct Srv;
@ -214,7 +216,7 @@ mod tests {
crate::always_ready!();
fn call(&self, _: ()) -> Self::Future {
ok(())
ready(Ok(()))
}
}
@ -235,7 +237,7 @@ mod tests {
#[actix_rt::test]
async fn test_new_service() {
let new_srv = (|| ok::<_, ()>(Srv)).into_factory().map(|_| "ok");
let new_srv = (|| ready(Ok::<_, ()>(Srv))).into_factory().map(|_| "ok");
let srv = new_srv.new_service(&()).await.unwrap();
let res = srv.call(()).await;
assert!(res.is_ok());

View File

@ -202,10 +202,12 @@ where
#[cfg(test)]
mod tests {
use core::future::{ready, Ready};
use futures_util::future::lazy;
use super::*;
use crate::{err, ok, IntoServiceFactory, Ready, ServiceExt, ServiceFactoryExt};
use crate::{IntoServiceFactory, ServiceExt, ServiceFactoryExt};
struct Srv;
@ -219,7 +221,7 @@ mod tests {
}
fn call(&self, _: ()) -> Self::Future {
err(())
ready(Err(()))
}
}
@ -240,7 +242,9 @@ mod tests {
#[actix_rt::test]
async fn test_new_service() {
let new_srv = (|| ok::<_, ()>(Srv)).into_factory().map_err(|_| "error");
let new_srv = (|| ready(Ok::<_, ()>(Srv)))
.into_factory()
.map_err(|_| "error");
let srv = new_srv.new_service(&()).await.unwrap();
let res = srv.call(()).await;
assert!(res.is_err());

View File

@ -1,54 +0,0 @@
//! When MSRV is 1.82, replace with `core::future::Ready` and `core::future::ready()`.
use core::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
/// Future for the [`ready`](ready()) function.
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Ready<T> {
val: Option<T>,
}
impl<T> Ready<T> {
/// Unwraps the value from this immediately ready future.
#[inline]
pub fn into_inner(mut self) -> T {
self.val.take().unwrap()
}
}
impl<T> Unpin for Ready<T> {}
impl<T> Future for Ready<T> {
type Output = T;
#[inline]
fn poll(mut self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<T> {
let val = self.val.take().expect("Ready can not be polled twice.");
Poll::Ready(val)
}
}
/// Creates a future that is immediately ready with a value.
#[allow(dead_code)]
pub(crate) fn ready<T>(val: T) -> Ready<T> {
Ready { val: Some(val) }
}
/// Create a future that is immediately ready with a success value.
#[allow(dead_code)]
pub(crate) fn ok<T, E>(val: T) -> Ready<Result<T, E>> {
Ready { val: Some(Ok(val)) }
}
/// Create a future that is immediately ready with an error value.
#[allow(dead_code)]
pub(crate) fn err<T, E>(err: E) -> Ready<Result<T, E>> {
Ready {
val: Some(Err(err)),
}
}

View File

@ -241,15 +241,15 @@ mod tests {
use alloc::rc::Rc;
use core::{
cell::Cell,
future::{ready, Ready},
task::{Context, Poll},
};
use futures_util::future::lazy;
use crate::{
err, ok,
pipeline::{pipeline, pipeline_factory},
ready, Ready, Service, ServiceFactory,
Service, ServiceFactory,
};
#[derive(Clone)]
@ -267,8 +267,8 @@ mod tests {
fn call(&self, req: Result<&'static str, &'static str>) -> Self::Future {
match req {
Ok(msg) => ok(msg),
Err(_) => err(()),
Ok(msg) => ready(Ok(msg)),
Err(_) => ready(Err(())),
}
}
}
@ -287,8 +287,8 @@ mod tests {
fn call(&self, req: Result<&'static str, ()>) -> Self::Future {
match req {
Ok(msg) => ok((msg, "ok")),
Err(()) => ok(("srv2", "err")),
Ok(msg) => ready(Ok((msg, "ok"))),
Err(()) => ready(Ok(("srv2", "err"))),
}
}
}

View File

@ -221,9 +221,10 @@ where
#[cfg(test)]
mod tests {
use core::time::Duration;
use actix_utils::future::{ready, Ready};
use core::{
future::{ready, Ready},
time::Duration,
};
use super::*;

View File

@ -2,6 +2,9 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.88.
- internal: Use `core::future::{ready, Ready}` instead of actix-utils'
## 3.5.0
- Update `rustls-native-certs` (`0.7`) dependency to `0.8`.

View File

@ -6,7 +6,7 @@
[![crates.io](https://img.shields.io/crates/v/actix-tls?label=latest)](https://crates.io/crates/actix-tls)
[![Documentation](https://docs.rs/actix-tls/badge.svg?version=3.5.0)](https://docs.rs/actix-tls/3.5.0)
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/actix-tls.svg)
<br />
[![Dependency Status](https://deps.rs/crate/actix-tls/3.5.0/status.svg)](https://deps.rs/crate/actix-tls/3.5.0)

View File

@ -2,6 +2,7 @@
//!
//! See [`Acceptor`] for main service factory docs.
use core::future::{ready, Ready as FutReady};
use std::{
convert::Infallible,
io::{self, IoSlice},
@ -15,10 +16,7 @@ use actix_rt::{
time::timeout,
};
use actix_service::{Service, ServiceFactory};
use actix_utils::{
counter::Counter,
future::{ready, Ready as FutReady},
};
use actix_utils::counter::Counter;
use futures_core::future::LocalBoxFuture;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_native_tls::{native_tls::Error, TlsAcceptor};

View File

@ -2,6 +2,7 @@
//!
//! See [`Acceptor`] for main service factory docs.
use core::future::{ready, Ready as FutReady};
use std::{
convert::Infallible,
future::Future,
@ -16,10 +17,7 @@ use actix_rt::{
time::{sleep, Sleep},
};
use actix_service::{Service, ServiceFactory};
use actix_utils::{
counter::{Counter, CounterGuard},
future::{ready, Ready as FutReady},
};
use actix_utils::counter::{Counter, CounterGuard};
use openssl::ssl::{Error, Ssl, SslAcceptor};
use pin_project_lite::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};

View File

@ -2,6 +2,7 @@
//!
//! See [`Acceptor`] for main service factory docs.
use core::future::{ready, Ready as FutReady};
use std::{
convert::Infallible,
future::Future,
@ -17,10 +18,7 @@ use actix_rt::{
time::{sleep, Sleep},
};
use actix_service::{Service, ServiceFactory};
use actix_utils::{
counter::{Counter, CounterGuard},
future::{ready, Ready as FutReady},
};
use actix_utils::counter::{Counter, CounterGuard};
use pin_project_lite::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_rustls::{Accept, TlsAcceptor};

View File

@ -2,6 +2,7 @@
//!
//! See [`Acceptor`] for main service factory docs.
use core::future::{ready, Ready as FutReady};
use std::{
convert::Infallible,
future::Future,
@ -17,10 +18,7 @@ use actix_rt::{
time::{sleep, Sleep},
};
use actix_service::{Service, ServiceFactory};
use actix_utils::{
counter::{Counter, CounterGuard},
future::{ready, Ready as FutReady},
};
use actix_utils::counter::{Counter, CounterGuard};
use pin_project_lite::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_rustls::{Accept, TlsAcceptor};

View File

@ -2,6 +2,7 @@
//!
//! See [`Acceptor`] for main service factory docs.
use core::future::{ready, Ready as FutReady};
use std::{
convert::Infallible,
future::Future,
@ -17,10 +18,7 @@ use actix_rt::{
time::{sleep, Sleep},
};
use actix_service::{Service, ServiceFactory};
use actix_utils::{
counter::{Counter, CounterGuard},
future::{ready, Ready as FutReady},
};
use actix_utils::counter::{Counter, CounterGuard};
use pin_project_lite::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_rustls::{Accept, TlsAcceptor};

View File

@ -2,6 +2,7 @@
//!
//! See [`Acceptor`] for main service factory docs.
use core::future::{ready, Ready as FutReady};
use std::{
convert::Infallible,
future::Future,
@ -17,10 +18,7 @@ use actix_rt::{
time::{sleep, Sleep},
};
use actix_service::{Service, ServiceFactory};
use actix_utils::{
counter::{Counter, CounterGuard},
future::{ready, Ready as FutReady},
};
use actix_utils::counter::{Counter, CounterGuard};
use pin_project_lite::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use tokio_rustls::{Accept, TlsAcceptor};

View File

@ -1,3 +1,4 @@
use core::future::{ready, Ready};
use std::{
future::Future,
pin::Pin,
@ -6,7 +7,6 @@ use std::{
use actix_rt::net::TcpStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use super::{
@ -49,7 +49,7 @@ impl<R: Host> ServiceFactory<ConnectInfo<R>> for Connector {
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(self.service())
ready(Ok(self.service()))
}
}

View File

@ -2,11 +2,11 @@
//!
//! See [`TlsConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::io;
use actix_rt::net::ActixStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::future::LocalBoxFuture;
use tokio_native_tls::{
native_tls::TlsConnector as NativeTlsConnector, TlsConnector as AsyncNativeTlsConnector,
@ -51,7 +51,7 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(self.clone())
ready(Ok(self.clone()))
}
}

View File

@ -2,6 +2,7 @@
//!
//! See [`TlsConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::{
future::Future,
io,
@ -11,7 +12,6 @@ use std::{
use actix_rt::net::ActixStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use openssl::ssl::SslConnector;
use tokio_openssl::SslStream as AsyncSslStream;
@ -64,9 +64,9 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(TlsConnectorService {
ready(Ok(TlsConnectorService {
connector: self.connector.clone(),
})
}))
}
}

View File

@ -1,3 +1,4 @@
use core::future::{ready, Ready};
use std::{
future::Future,
io,
@ -10,7 +11,6 @@ use std::{
use actix_rt::task::{spawn_blocking, JoinHandle};
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::{future::LocalBoxFuture, ready};
use tracing::trace;
@ -45,7 +45,7 @@ impl<R: Host> ServiceFactory<ConnectInfo<R>> for Resolver {
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(self.resolver.clone())
ready(Ok(self.resolver.clone()))
}
}

View File

@ -2,6 +2,7 @@
//!
//! See [`TlsConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::{
future::Future,
io,
@ -12,7 +13,6 @@ use std::{
use actix_rt::net::ActixStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use tokio_rustls::{
client::TlsStream as AsyncTlsStream,
@ -100,9 +100,9 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(TlsConnectorService {
ready(Ok(TlsConnectorService {
connector: self.connector.clone(),
})
}))
}
}

View File

@ -2,6 +2,7 @@
//!
//! See [`TlsConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::{
future::Future,
io,
@ -12,7 +13,6 @@ use std::{
use actix_rt::net::ActixStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use tokio_rustls::{
client::TlsStream as AsyncTlsStream,
@ -100,9 +100,9 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(TlsConnectorService {
ready(Ok(TlsConnectorService {
connector: self.connector.clone(),
})
}))
}
}

View File

@ -2,6 +2,7 @@
//!
//! See [`TlsConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::{
future::Future,
io,
@ -12,7 +13,6 @@ use std::{
use actix_rt::net::ActixStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use rustls_pki_types_1::ServerName;
use tokio_rustls::{
@ -91,9 +91,9 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(TlsConnectorService {
ready(Ok(TlsConnectorService {
connector: self.connector.clone(),
})
}))
}
}

View File

@ -2,6 +2,7 @@
//!
//! See [`TlsConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::{
future::Future,
io,
@ -12,7 +13,6 @@ use std::{
use actix_rt::net::ActixStream;
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use rustls_pki_types_1::ServerName;
use tokio_rustls::{
@ -91,9 +91,9 @@ where
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(TlsConnectorService {
ready(Ok(TlsConnectorService {
connector: self.connector.clone(),
})
}))
}
}

View File

@ -2,6 +2,7 @@
//!
//! See [`TcpConnector`] for main connector service factory docs.
use core::future::{ready, Ready};
use std::{
collections::VecDeque,
future::Future,
@ -13,7 +14,6 @@ use std::{
use actix_rt::net::{TcpSocket, TcpStream};
use actix_service::{Service, ServiceFactory};
use actix_utils::future::{ok, Ready};
use futures_core::ready;
use tokio_util::sync::ReusableBoxFuture;
use tracing::{error, trace};
@ -41,7 +41,7 @@ impl<R: Host> ServiceFactory<ConnectInfo<R>> for TcpConnector {
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future {
ok(self.service())
ready(Ok(self.service()))
}
}

View File

@ -7,6 +7,7 @@
feature = "openssl"
))]
use core::future::ready;
use std::{io::Write as _, sync::Arc};
use actix_rt::net::TcpStream;
@ -16,7 +17,6 @@ use actix_tls::{
accept::openssl::{Acceptor, TlsStream},
connect::rustls_0_23::reexports::ClientConfig,
};
use actix_utils::future::ok;
use rustls_pki_types_1::ServerName;
use tokio_rustls_026::rustls::RootCertStore;
@ -127,7 +127,7 @@ async fn accepts_connections() {
tls_acceptor
.map_err(|err| println!("OpenSSL error: {err:?}"))
.and_then(move |_stream: TlsStream<TcpStream>| ok(()))
.and_then(move |_stream: TlsStream<TcpStream>| ready(Ok(())))
}
});

View File

@ -9,6 +9,7 @@
extern crate tls_openssl as openssl;
use core::future::ready;
use std::io::{BufReader, Write};
use actix_rt::net::TcpStream;
@ -18,7 +19,6 @@ use actix_tls::{
accept::rustls_0_23::{reexports::ServerConfig, Acceptor, TlsStream},
connect::openssl::reexports::SslConnector,
};
use actix_utils::future::ok;
use rustls_pemfile::{certs, pkcs8_private_keys};
use rustls_pki_types_1::PrivateKeyDer;
use tls_openssl::ssl::SslVerifyMode;
@ -88,7 +88,7 @@ async fn accepts_connections() {
tls_acceptor
.map_err(|err| println!("Rustls error: {err:?}"))
.and_then(move |_stream: TlsStream<TcpStream>| ok(()))
.and_then(move |_stream: TlsStream<TcpStream>| ready(Ok(())))
}
});

View File

@ -2,7 +2,8 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
- internal: Use `core::future::{ready, Ready}` instead of actix-utils'
## 0.1.0

View File

@ -3,12 +3,15 @@
#![doc(html_logo_url = "https://actix.rs/img/logo.png")]
#![doc(html_favicon_url = "https://actix.rs/favicon.ico")]
use core::marker::PhantomData;
use core::{
future::{ready, Ready},
marker::PhantomData,
};
use actix_service::{
apply, ApplyTransform, IntoServiceFactory, Service, ServiceFactory, Transform,
};
use actix_utils::future::{ok, Either, Ready};
use actix_utils::future::Either;
use tracing_futures::{Instrument, Instrumented};
/// A `Service` implementation that automatically enters/exits tracing spans
@ -84,7 +87,7 @@ where
type Future = Ready<Result<Self::Transform, Self::InitError>>;
fn new_transform(&self, service: S) -> Self::Future {
ok(TracingService::new(service, self.make_span.clone()))
ready(Ok(TracingService::new(service, self.make_span.clone())))
}
}
@ -118,6 +121,7 @@ where
#[cfg(test)]
mod test {
use core::future::ready;
use std::{
cell::RefCell,
collections::{BTreeMap, BTreeSet},
@ -221,10 +225,10 @@ mod test {
#[actix_rt::test]
async fn service_call() {
let service_factory = fn_factory(|| {
ok::<_, ()>(fn_service(|req: &'static str| {
ready(Ok::<_, ()>(fn_service(|req: &'static str| {
tracing::event!(Level::TRACE, "It's happening - {}!", req);
ok::<_, ()>(())
}))
ready(Ok::<_, ()>(()))
})))
});
let subscriber = TestSubscriber::default();

View File

@ -2,7 +2,8 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
- Deprecate `crate::ready::*` in favor of `core::future::{ready, Ready}`
## 3.0.1

View File

@ -15,7 +15,8 @@ pin_project! {
///
/// # Examples
/// ```
/// use actix_utils::future::{ready, Ready, Either};
/// use actix_utils::future::Either;
/// use core::future::{ready, Ready};
///
/// # async fn run() {
/// let res = Either::<_, Ready<usize>>::left(ready(42));
@ -81,8 +82,9 @@ where
#[cfg(test)]
mod tests {
use core::future::{ready, Ready};
use super::*;
use crate::future::{ready, Ready};
#[actix_rt::test]
async fn test_either() {

View File

@ -4,8 +4,9 @@ mod either;
mod poll_fn;
mod ready;
#[allow(deprecated)]
pub use self::ready::{err, ok, ready, Ready};
pub use self::{
either::Either,
poll_fn::{poll_fn, PollFn},
ready::{err, ok, ready, Ready},
};

View File

@ -1,4 +1,6 @@
//! When `core::future::Ready` has a `into_inner()` method, this can be deprecated.
//! Deprecated. Use `core::future::Ready` instead, it has the same functionality.
#![allow(deprecated)]
use core::{
future::Future,
@ -26,6 +28,7 @@ use core::{
/// ```
#[derive(Debug, Clone)]
#[must_use = "futures do nothing unless you `.await` or poll them"]
#[deprecated(since = "3.0.2", note = "Use `core::future::Ready` instead.")]
pub struct Ready<T> {
val: Option<T>,
}
@ -66,6 +69,7 @@ impl<T> Future for Ready<T> {
/// assert_eq!(a.into_inner(), 1);
/// ```
#[inline]
#[deprecated(since = "3.0.2", note = "Use `core::future::ready(val)` instead.")]
pub fn ready<T>(val: T) -> Ready<T> {
Ready { val: Some(val) }
}
@ -82,6 +86,7 @@ pub fn ready<T>(val: T) -> Ready<T> {
/// # }
/// ```
#[inline]
#[deprecated(since = "3.0.2", note = "Use `core::future::ready(Ok(val))` instead.")]
pub fn ok<T, E>(val: T) -> Ready<Result<T, E>> {
Ready { val: Some(Ok(val)) }
}
@ -98,6 +103,7 @@ pub fn ok<T, E>(val: T) -> Ready<Result<T, E>> {
/// # }
/// ```
#[inline]
#[deprecated(since = "3.0.2", note = "Use `core::future::ready(Err(err))` instead.")]
pub fn err<T, E>(err: E) -> Ready<Result<T, E>> {
Ready {
val: Some(Err(err)),
@ -105,6 +111,7 @@ pub fn err<T, E>(err: E) -> Ready<Result<T, E>> {
}
#[cfg(test)]
#[allow(deprecated)]
mod tests {
use std::rc::Rc;

View File

@ -2,7 +2,7 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
## 1.5.0

View File

@ -6,7 +6,7 @@
[![crates.io](https://img.shields.io/crates/v/bytestring?label=latest)](https://crates.io/crates/bytestring)
[![Documentation](https://docs.rs/bytestring/badge.svg?version=1.5.0)](https://docs.rs/bytestring/1.5.0)
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/bytestring.svg)
<br />
[![Dependency Status](https://deps.rs/crate/bytestring/1.5.0/status.svg)](https://deps.rs/crate/bytestring/1.5.0)

View File

@ -23,14 +23,6 @@ fmt:
# Downgrade dependencies necessary to run MSRV checks/tests.
[private]
downgrade-for-msrv:
cargo {{ toolchain }} update -p=rayon --precise=1.10.0 # next ver: 1.80.0
cargo {{ toolchain }} update -p=rayon-core --precise=1.12.1 # next ver: 1.80.0
cargo {{ toolchain }} update -p=native-tls --precise=0.2.13 # next ver: 1.80.0
cargo {{ toolchain }} update -p=idna_adapter --precise=1.2.0 # next ver: 1.82.0
cargo {{ toolchain }} update -p=litemap --precise=0.7.4 # next ver: 1.81.0
cargo {{ toolchain }} update -p=zerofrom --precise=0.1.5 # next ver: 1.81.0
cargo {{ toolchain }} update -p=half --precise=2.4.1 # next ver: 1.81.0
cargo {{ toolchain }} update -p=time --precise=0.3.41 # next ver: 1.81.0
msrv := ```
cargo metadata --format-version=1 \

View File

@ -2,7 +2,7 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
## 0.1.5

View File

@ -6,7 +6,7 @@
[![crates.io](https://img.shields.io/crates/v/local-channel?label=latest)](https://crates.io/crates/local-channel)
[![Documentation](https://docs.rs/local-channel/badge.svg?version=0.1.5)](https://docs.rs/local-channel/0.1.5)
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/local-channel.svg)
<br />
[![Dependency Status](https://deps.rs/crate/local-channel/0.1.5/status.svg)](https://deps.rs/crate/local-channel/0.1.5)

View File

@ -2,7 +2,7 @@
## Unreleased
- Minimum supported Rust version (MSRV) is now 1.76.
- Minimum supported Rust version (MSRV) is now 1.88.
## 0.1.4

View File

@ -6,7 +6,7 @@
[![crates.io](https://img.shields.io/crates/v/local-waker?label=latest)](https://crates.io/crates/local-waker)
[![Documentation](https://docs.rs/local-waker/badge.svg?version=0.1.4)](https://docs.rs/local-waker/0.1.4)
[![Version](https://img.shields.io/badge/rustc-1.52+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
[![Version](https://img.shields.io/badge/rustc-1.88+-ab6000.svg)](https://blog.rust-lang.org/2021/05/06/Rust-1.52.0.html)
![MIT or Apache 2.0 licensed](https://img.shields.io/crates/l/local-waker.svg)
<br />
[![Dependency Status](https://deps.rs/crate/local-waker/0.1.4/status.svg)](https://deps.rs/crate/local-waker/0.1.4)