January 2019
Intermediate to advanced
520 pages
14h 32m
English
We already implemented the worker in the JSON-RPC example. In the gRPC version, we use have same code, but expect a Receiver value and don't spawn a new thread:
fn worker_loop(receiver: Receiver<Action>) -> Result<(), Error> { let next = env::var("NEXT")?.parse()?; let remote = Remote::new(next)?; let mut in_roll_call = false; for action in receiver.iter() { match action { /* Action variants here */ } } Ok(())}
Let's compile and run this example.
Read now
Unlock full access