From the course: Rust: Asynchronous Programming with Tokio

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Watch channel

Watch channel

- [Instructor] Flying is stressful. When your flight can be on time, delayed, or even canceled, your flight status is something that must be constantly monitored. That's why airlines created apps that set up watch channels between you and your flight. A watch channel is a single-producer, multiple-consumer channel typically used to monitor state changes of an object. In our airline example, the flight is the one producer sending out messages like on time, delayed, canceled, and the people using the apps to monitor the flight status are the consumers. Tokio's watch channels work the same way as the airlines watch channels, while also giving us trade secrets on how all watch channels work. For example, the Tokio documentation tells us that the consumers of a watch channel are not guaranteed to receive every message sent through the channel. This is because a watch channel only sends the most recent message, which…

Contents