libp2p::tcp::async_io

Type Alias Transport

pub type Transport = Transport<Tcp>;
Available on crate features tcp and async-io only.
Expand description

A TCP Transport that works with the async-std ecosystem.

§Example

let mut transport = tcp::async_io::Transport::new(tcp::Config::default());
let id = ListenerId::next();
transport
    .listen_on(id, "/ip4/127.0.0.1/tcp/0".parse().unwrap())
    .unwrap();

let addr = future::poll_fn(|cx| Pin::new(&mut transport).poll(cx))
    .await
    .into_new_address()
    .unwrap();

println!("Listening on {addr}");

Aliased Type§

struct Transport { /* private fields */ }