This crate provides a trait for taking ownership of a [Stream
] of incoming connections.
The types tokio provides, [tokio::net::tcp::Incoming
] and [tokio::net::unix::Incoming
], are
both tied to the lifetime of their respective Listeners [1].
The provided .incoming()
used to consume self, but this was changed
.
```rust
async fn useownedstream(s: S)
where
S: Stream
fn main() -> Result<(), Box
use incoming::IntoIncoming;
rt.block_on(async move {
let addr: std::net::SocketAddr = "0.0.0.0:4242".parse()?;
let st = tokio::net::TcpListener::bind(addr).await?;
use_owned_stream(st.into_incoming()).await;
Ok(())
})
} ```