Enum google_maps::directions::request::traffic_model::TrafficModel
source · #[repr(u8)]pub enum TrafficModel {
BestGuess = 0,
Optimistic = 1,
Pessimistic = 2,
}
Expand description
Specifies the traffic model to use when calculating time in traffic.
This setting affects the value returned in the duration_in_traffic
field
in the response, which contains the predicted time in traffic based on
historical averages. The traffic_model
parameter may only be specified for
driving directions where the request includes a departure_time
, and only
if the request includes an API key or a Google Maps Platform Premium Plan
client ID.
The default value of best_guess
will give the most useful predictions for
the vast majority of use cases. It is possible the best_guess
travel time
prediction may be shorter than optimistic
, or alternatively, longer
than pessimistic
, due to the way the best_guess
prediction model
integrates live traffic information.
Variants§
BestGuess = 0
Indicates that the returned duration_in_traffic
should be the best
estimate of travel time given what is known about both historical
traffic conditions and live traffic. Live traffic becomes more important
the closer the departure_time
is to now.
Optimistic = 1
Indicates that the returned duration_in_traffic
should be shorter than
the actual travel time on most days, though occasional days with
particularly good traffic conditions may be faster than this value.
Pessimistic = 2
Indicates that the returned duration_in_traffic
should be longer than
the actual travel time on most days, though occasional days with
particularly bad traffic conditions may exceed this value.
Implementations§
Trait Implementations§
source§impl Clone for TrafficModel
impl Clone for TrafficModel
source§fn clone(&self) -> TrafficModel
fn clone(&self) -> TrafficModel
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TrafficModel
impl Debug for TrafficModel
source§impl Default for TrafficModel
impl Default for TrafficModel
source§fn default() -> TrafficModel
fn default() -> TrafficModel
source§impl<'de> Deserialize<'de> for TrafficModel
impl<'de> Deserialize<'de> for TrafficModel
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Manual implementation of Deserialize
for serde
. This will take
advantage of the phf
-powered TryFrom
implementation for this type.
source§impl Display for TrafficModel
impl Display for TrafficModel
source§impl From<&TrafficModel> for &str
impl From<&TrafficModel> for &str
source§fn from(traffic_model: &TrafficModel) -> Self
fn from(traffic_model: &TrafficModel) -> Self
Converts a TrafficModel
enum to a String
that contains a traffic
model
code.
source§impl From<&TrafficModel> for String
impl From<&TrafficModel> for String
source§fn from(traffic_model: &TrafficModel) -> Self
fn from(traffic_model: &TrafficModel) -> Self
Converts a TrafficModel
enum to a String
that contains a traffic
model
code.
source§impl FromStr for TrafficModel
impl FromStr for TrafficModel
source§impl Hash for TrafficModel
impl Hash for TrafficModel
source§impl Ord for TrafficModel
impl Ord for TrafficModel
source§fn cmp(&self, other: &TrafficModel) -> Ordering
fn cmp(&self, other: &TrafficModel) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for TrafficModel
impl PartialEq for TrafficModel
source§fn eq(&self, other: &TrafficModel) -> bool
fn eq(&self, other: &TrafficModel) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for TrafficModel
impl PartialOrd for TrafficModel
source§fn partial_cmp(&self, other: &TrafficModel) -> Option<Ordering>
fn partial_cmp(&self, other: &TrafficModel) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more