The Rust Programming Language
Download all the
Slides (updated on
demand).
Session 1
Session 2
Session 3
Session 3 - Homework
Pick one! Send me your main.rs
file and upload it
here
Option 1: Guess the number game
The task: Write a command line application where users can guess a number
- Use a random number generator to generate an integer number
- Let the user guess until they manage to get the right answer
- React gracefully on errors
- Stretch goal: Limit the number of tries based on a CLI argument
- Stretch goal: Limit the range based on a CLI argument
Option 2: Telnet chat
Take the examples on async Rust and write a telnet chat. The Tokio
examples from the slides will help you.
-
The chat accepts new connections on localhost (to connect with
telnet localhost PORT_NUMBER
) where
PORT_NUMBER
is up to you
- The chat gracefully drops connections once the clients end it
-
Clients are able to write messages, they are distributed to all other
clients
- Use channels to distribute messages
-
Use
async-std
or tokio
to fulfil your goal