rsynko_reqwest/observation.rs
1use rsynko_memory::DownloadObservationOp;
2use std::sync::mpsc::{Receiver, Sender, channel};
3
4/// Carries one pure download observation.
5pub type RuntimeObservation = DownloadObservationOp;
6
7/// Sends download observations from the thread that retrieves.
8pub type RuntimeObservationSender = Sender<RuntimeObservation>;
9
10/// Receives what one running download states, for whoever attends to it.
11pub type RuntimeObservationReceiver = Receiver<RuntimeObservation>;
12
13/// Constructs one observation channel without consuming its receiving end.
14///
15/// A download states what it does whether or not anybody reads it, so nothing here is asked and
16/// nothing is answered: the retrieving thread never waits on whoever is watching.
17pub fn runtime_observation_channel() -> (RuntimeObservationSender, RuntimeObservationReceiver) {
18 channel()
19}