mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-28 12:10:37 +00:00

Uses the infrastructure added by #2828 to enable switching `TcpListener::accept` to use `&self`. This also switches `poll_accept` to use `&self`. While doing introduces a hazard, `poll_*` style functions are considered low-level. Most users will use the `async fn` variants which are more misuse-resistant. TcpListener::incoming() is temporarily removed as it has the same problem as `TcpSocket::by_ref()` and will be implemented later.
Examples of how to use Tokio
This directory contains a number of examples showcasing various capabilities of
the tokio
crate.
All examples can be executed with:
cargo run --example $name
A good starting point for the examples would be hello_world
and echo
. Additionally the tokio website contains
additional guides for some of the examples.
For a larger "real world" example, see the mini-redis
repository.
If you've got an example you'd like to see here, please feel free to open an issue. Otherwise if you've got an example you'd like to add, please feel free to make a PR!