Skip to content

Commit 25209f5

Browse files
committed
use impl-more in -tls
1 parent c4a0f37 commit 25209f5

File tree

8 files changed

+10
-57
lines changed

8 files changed

+10
-57
lines changed

actix-service/src/macros.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
/// }
2626
/// }
2727
/// ```
28+
///
29+
/// [`forward_ready!`]: crate::forward_ready
2830
#[macro_export]
2931
macro_rules! always_ready {
3032
() => {

actix-tls/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ actix-service = "2.0.0"
4848
actix-utils = "3.0.0"
4949

5050
futures-core = { version = "0.3.7", default-features = false, features = ["alloc"] }
51+
impl-more = "0.1.0"
5152
pin-project-lite = "0.2.7"
5253
tokio-util = "0.7"
5354
tracing = { version = "0.1.30", default-features = false, features = ["log"] }

actix-tls/src/accept/native_tls.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use futures_core::future::LocalBoxFuture;
2424
use tokio_native_tls::{native_tls::Error, TlsAcceptor};
2525

2626
use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER};
27-
use crate::impl_more;
2827

2928
pub mod reexports {
3029
//! Re-exports from `native-tls` that are useful for acceptors.
@@ -35,9 +34,8 @@ pub mod reexports {
3534
/// Wraps a `native-tls` based async TLS stream in order to implement [`ActixStream`].
3635
pub struct TlsStream<IO>(tokio_native_tls::TlsStream<IO>);
3736

38-
impl_more::from! { tokio_native_tls::TlsStream<IO> => TlsStream<IO> }
39-
impl_more::deref! { TlsStream<IO> => 0: tokio_native_tls::TlsStream<IO> }
40-
impl_more::deref_mut! { TlsStream<IO> => 0 }
37+
impl_more::impl_from!(<IO> in tokio_native_tls::TlsStream<IO> => TlsStream<IO>);
38+
impl_more::impl_deref_and_mut!(<IO> in TlsStream<IO> => tokio_native_tls::TlsStream<IO>);
4139

4240
impl<IO: ActixStream> AsyncRead for TlsStream<IO> {
4341
fn poll_read(

actix-tls/src/accept/openssl.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use openssl::ssl::{Error, Ssl, SslAcceptor};
2525
use pin_project_lite::pin_project;
2626

2727
use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER};
28-
use crate::impl_more;
2928

3029
pub mod reexports {
3130
//! Re-exports from `openssl` that are useful for acceptors.
@@ -38,9 +37,8 @@ pub mod reexports {
3837
/// Wraps an `openssl` based async TLS stream in order to implement [`ActixStream`].
3938
pub struct TlsStream<IO>(tokio_openssl::SslStream<IO>);
4039

41-
impl_more::from! { tokio_openssl::SslStream<IO> => TlsStream<IO> }
42-
impl_more::deref! { TlsStream<IO> => 0: tokio_openssl::SslStream<IO> }
43-
impl_more::deref_mut! { TlsStream<IO> => 0 }
40+
impl_more::impl_from!(<IO> in tokio_openssl::SslStream<IO> => TlsStream<IO>);
41+
impl_more::impl_deref_and_mut!(<IO> in TlsStream<IO> => tokio_openssl::SslStream<IO>);
4442

4543
impl<IO: ActixStream> AsyncRead for TlsStream<IO> {
4644
fn poll_read(

actix-tls/src/accept/rustls.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use tokio_rustls::rustls::ServerConfig;
2727
use tokio_rustls::{Accept, TlsAcceptor};
2828

2929
use super::{TlsError, DEFAULT_TLS_HANDSHAKE_TIMEOUT, MAX_CONN_COUNTER};
30-
use crate::impl_more;
3130

3231
pub mod reexports {
3332
//! Re-exports from `rustls` that are useful for acceptors.
@@ -38,9 +37,8 @@ pub mod reexports {
3837
/// Wraps a `rustls` based async TLS stream in order to implement [`ActixStream`].
3938
pub struct TlsStream<IO>(tokio_rustls::server::TlsStream<IO>);
4039

41-
impl_more::from! { tokio_rustls::server::TlsStream<IO> => TlsStream<IO> }
42-
impl_more::deref! { TlsStream<IO> => 0: tokio_rustls::server::TlsStream<IO> }
43-
impl_more::deref_mut! { TlsStream<IO> => 0 }
40+
impl_more::impl_from!(<IO> in tokio_rustls::server::TlsStream<IO> => TlsStream<IO>);
41+
impl_more::impl_deref_and_mut!(<IO> in TlsStream<IO> => tokio_rustls::server::TlsStream<IO>);
4442

4543
impl<IO: ActixStream> AsyncRead for TlsStream<IO> {
4644
fn poll_read(

actix-tls/src/connect/connection.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use super::Host;
2-
use crate::impl_more;
32

43
/// Wraps underlying I/O and the connection request that initiated it.
54
#[derive(Debug)]
@@ -8,8 +7,7 @@ pub struct Connection<R, IO> {
87
pub(crate) io: IO,
98
}
109

11-
impl_more::deref! { Connection<R, IO> => io: IO }
12-
impl_more::deref_mut! { Connection<R, IO> => io }
10+
impl_more::impl_deref_and_mut!(<R, IO> in Connection<R, IO> => io: IO);
1311

1412
impl<R, IO> Connection<R, IO> {
1513
/// Construct new `Connection` from request and IO parts.

actix-tls/src/impl_more.rs

Lines changed: 0 additions & 40 deletions
This file was deleted.

actix-tls/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ pub mod accept;
1818
#[cfg(feature = "connect")]
1919
#[cfg_attr(docsrs, doc(cfg(feature = "connect")))]
2020
pub mod connect;
21-
22-
mod impl_more;

0 commit comments

Comments
 (0)