google_maps/request_rate/mod.rs
1//! Contains the `RequestRate` struct and its associated traits. It is used to
2//! specify Google Maps Platform and per-API request rate limits. **Do not use
3//! this module to set request rates. Use the `GoogleMapsClient` methods
4//! instead.**
5
6pub mod api;
7mod api_rate;
8pub mod api_rate_limit;
9mod current_rate;
10mod duration_to_string;
11mod duration_unit;
12mod limit;
13mod rate_to_string;
14mod target_rate;
15mod with_rate;
16
17// -----------------------------------------------------------------------------
18
19use crate::request_rate::api::Api;
20use crate::request_rate::api_rate::ApiRate;
21use std::collections::HashMap;
22
23// -----------------------------------------------------------------------------
24//
25/// Contains the request rates for the Google Maps Platform and the individual
26/// Google Maps APIs.
27
28#[derive(Clone, Debug, Eq, PartialEq)]
29pub struct RequestRate {
30 /// Used to specify the request rate for _all_ APIs in addition to the
31 /// per-API request rates. The `Api::All` request rate will be observed
32 /// first, then the per-API request rate such as `Api::Directions` will be
33 /// observed afterward.
34 pub rate_map: HashMap<Api, ApiRate>,
35} // struct
36
37// -----------------------------------------------------------------------------
38
39impl std::default::Default for RequestRate {
40 /// Returns default values (empty) for the `RequestRate` struct.
41 fn default() -> Self {
42 Self {
43 rate_map: HashMap::new(),
44 } // struct
45 } // fn
46} // impl