2 ms·
Here is a small TCP client example: https://github.com/rustasync/runtime/blob/master/examples/tcp-client.rs https://github.com/rustasync/runtime/blob/master/exa
by steveklabnik 7y ago
Here is a small TCP client example: https://github.com/rustasync/runtime/blob/master/examples/tcp-client.rs https://github.com/rustasync/runtime/blob/master/examples/tc...
Note "async fn main" on line 15, and the ".await"s on 21 and 24.
Now, if you read my other comment about executors, this is using a crate called "runtime", which handles submitting it for you, see the `#[]` bit on line 14. Regardless, the syntax would look like this even without this crate; it just removes some boilerplate around the executor and submitting your future to it.