January 2019
Intermediate to advanced
520 pages
14h 32m
English
The find_unicorn function picks one of the three predefined values of Unicorn:
fn find_unicorn(location: &Location) -> Unicorn { debug!("Finding unicorn for {}, {}", location.latitude, location.longitude); let unicorns = [ Unicorn::new("Bucephalus", "Golden", "Male"), Unicorn::new("Shadowfax", "White", "Male"), Unicorn::new("Rocinante", "Yellow", "Female"), ]; let mut rng = thread_rng(); unicorns.iter().choose(&mut rng).cloned().unwrap() }
The record_ride function constructs put requests from DynamoDB. To make this kind of request, we need to fill a HashMap with attributes only. If you want to learn more about how to interact with DynamoDB, you can return to Chapter 7, Reliable Integration with Databases, in which we explored interaction ...
Read now
Unlock full access