[−][src]Struct google_maps::client_settings::ClientSettings
Contains information used for authenticating with Google and other settings.
Fields
key: String
Your application's API key. This key identifies your application for purposes of quota management. Learn how to get a key. Contains the application's API key and other settings.
max_retries: u8
Certain network & server-side errors may be successful if retried with the same payload. This parameter sets the maximum number of times the client should retry before giving up.
max_backoff: u32
It's okay to continue retrying once you reach the max_backoff time. Retries after this point do not need to continue increasing backoff time. For example, if a client uses an max_backoff time of 64 seconds, then after reaching this value, the client can retry every 64 seconds. At some point, clients should be prevented from retrying infinitely.
How long clients should wait between retries and how many times they should retry depends on your use case and network conditions. For example, mobile clients of an application may need to retry more times and for longer intervals when compared to desktop clients of the same application.
rate_limit: RequestRate
Rate limits for each of the Google Cloud Maps Platform APIs.
Methods
impl ClientSettings
[src]
pub fn finalize(&self) -> ClientSettings
[src]
impl ClientSettings
[src]
pub fn new(key: &str) -> ClientSettings
[src]
Initialize the settings needed for a Google Cloud Maps API transaction.
impl ClientSettings
[src]
pub fn with_max_delay(&mut self, max_delay: Duration) -> &mut ClientSettings
[src]
Sets the maximum delay between request retries upon consecutive failures.
Arguments
max_delay
‧ The maximum delay between request retries.
Description
Client will continue retrying once you the max_delay
time is reached.
Retries after this point will not continue increasing backoff time. For
example, if a client uses an max_delay
time of 64 seconds, then
after reaching this value, the client can retry every 64 seconds.
How long clients should wait between retries and how many times they should retry depends on your use case and network conditions. For example, mobile clients of an application may need to retry more times and for longer intervals when compared to desktop clients of the same application.
Example:
- Sets the maximum delay between request retries to 32 seconds:
.with_max_delay(Api::All, Duration::seconds(32))
impl ClientSettings
[src]
pub fn with_max_retries(&mut self, max_retries: u8) -> &mut ClientSettings
[src]
impl ClientSettings
[src]
pub fn with_rate(
&mut self,
api: Api,
requests: u16,
per_duration: Duration
) -> &mut ClientSettings
[src]
&mut self,
api: Api,
requests: u16,
per_duration: Duration
) -> &mut ClientSettings
Sets the rate limit for the specified API.
Arguments
-
api
‧ Which Google Maps API are you setting the rate limit for? For example,Api::Directions
,Api::DistanceMatrix
,Api::Elevation
,Api::Geocoding
,Api::TimeZone
, and so on. TheApi::All
rate limit is applied to all Google Maps API requests in addition to the per-API rate limits. -
requests
‧ Sets the maximum number of requests in the specified duration. For example, 2 requests per 1 hour. -
per_duration
‧ Sets the duration window that the requests should be measured against. For example, 1 request per 1 minute.
Examples:
- Sets the rate limit for all Google Maps API requests to 2 request per minute:
.with_rate(Api::All, 2, Duration::minutes(1))
- Sets the rate limit for Google Maps Elevation API requests to 1 requests per second:
.with_rate(Api::Elevation, 1, Duration::seconds(1))
- This method can be stacked:
.with_rate(Api::All, 1, Duration::seconds(1)) .with_rate(Api::Directions, 1, Duration::hours(1)) .with_rate(Api::TimeZone, 2, Duration::hours(1))
Trait Implementations
impl Clone for ClientSettings
[src]
fn clone(&self) -> ClientSettings
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for ClientSettings
[src]
impl Eq for ClientSettings
[src]
impl Ord for ClientSettings
[src]
fn cmp(&self, other: &ClientSettings) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<ClientSettings> for ClientSettings
[src]
fn eq(&self, other: &ClientSettings) -> bool
[src]
fn ne(&self, other: &ClientSettings) -> bool
[src]
impl PartialOrd<ClientSettings> for ClientSettings
[src]
fn partial_cmp(&self, other: &ClientSettings) -> Option<Ordering>
[src]
fn lt(&self, other: &ClientSettings) -> bool
[src]
fn le(&self, other: &ClientSettings) -> bool
[src]
fn gt(&self, other: &ClientSettings) -> bool
[src]
fn ge(&self, other: &ClientSettings) -> bool
[src]
impl StructuralEq for ClientSettings
[src]
impl StructuralPartialEq for ClientSettings
[src]
Auto Trait Implementations
impl RefUnwindSafe for ClientSettings
impl Send for ClientSettings
impl Sync for ClientSettings
impl Unpin for ClientSettings
impl UnwindSafe for ClientSettings
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,