tokio_dual_stack

Dual-stack TcpListener.
git clone https://git.philomathiclife.com/repos/tokio_dual_stack
Log | Files | Refs | README

commit f6ee0a3f6bb3651bc0e28f5bd975602465682fe8
parent 8808bfcea2aaa625775628939cc3e35078543ec2
Author: Zack Newman <zack@philomathiclife.com>
Date:   Thu, 20 Feb 2025 14:24:32 -0700

rust 2024

Diffstat:
MCargo.toml | 6+++---
Msrc/lib.rs | 24++++++++----------------
2 files changed, 11 insertions(+), 19 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml @@ -3,14 +3,14 @@ authors = ["Zack Newman <zack@philomathiclife.com>"] categories = ["asynchronous", "network-programming"] description = "Dual-stack TCP listener based on tokio." documentation = "https://docs.rs/webauthn_rp/latest/tokio_dual_stack/" -edition = "2021" +edition = "2024" keywords = ["ip", "listener", "tcp", "tokio"] license = "MIT OR Apache-2.0" name = "tokio_dual_stack" readme = "README.md" repository = "https://git.philomathiclife.com/repos/tokio_dual_stack/" -rust-version = "1.84.0" -version = "0.1.0" +rust-version = "1.85.0" +version = "0.1.1" [dependencies] pin-project-lite = { version = "0.2.16", default-features = false } diff --git a/src/lib.rs b/src/lib.rs @@ -173,10 +173,6 @@ pub trait Tcp: Sealed + Sized { } impl Sealed for TcpListener {} impl Tcp for TcpListener { - #[expect( - clippy::future_not_send, - reason = "TcpListener::bind Future is not send" - )] #[inline] fn bind<A: ToSocketAddrs>(addr: A) -> impl Future<Output = Result<Self>> { Self::bind(addr) @@ -412,9 +408,9 @@ pin_project! { } } impl< - F: Future<Output = Result<(TcpStream, SocketAddr)>>, - F2: Future<Output = Result<(TcpStream, SocketAddr)>>, - > Future for AcceptFut<F, F2> + F: Future<Output = Result<(TcpStream, SocketAddr)>>, + F2: Future<Output = Result<(TcpStream, SocketAddr)>>, +> Future for AcceptFut<F, F2> { type Output = Result<(TcpStream, SocketAddr)>; fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { @@ -427,10 +423,6 @@ impl< } impl Sealed for DualStackTcpListener {} impl Tcp for DualStackTcpListener { - #[expect( - clippy::future_not_send, - reason = "TcpListener::bind Future is not send" - )] #[inline] async fn bind<A: ToSocketAddrs>(addr: A) -> Result<Self> { match net::lookup_host(addr).await { @@ -452,7 +444,7 @@ impl Tcp for DualStackTcpListener { } } Err(err) => last_err = Some(err), - }; + } } Some(ip4) => { if sock.is_ipv6() { @@ -462,10 +454,10 @@ impl Tcp for DualStackTcpListener { ip6, ip4, ip6_first: AtomicBool::new(true), - }) + }); } Err(err) => last_err = Some(err), - }; + } } ip4_opt = Some(ip4); } @@ -478,10 +470,10 @@ impl Tcp for DualStackTcpListener { ip6, ip4, ip6_first: AtomicBool::new(true), - }) + }); } Err(err) => last_err = Some(err), - }; + } } ip6_opt = Some(ip6); }