#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::invalid_html_tags)]
#![allow(rustdoc::redundant_explicit_links)]
#![no_implicit_prelude]
extern crate async_trait;
extern crate bytes;
extern crate gaxi;
extern crate google_cloud_gax;
extern crate google_cloud_type;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate tracing;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SnapToRoadsRequest {
pub path: std::string::String,
pub interpolate: bool,
pub asset_id: std::string::String,
pub travel_mode: crate::model::TravelMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SnapToRoadsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.path = v.into();
self
}
pub fn set_interpolate<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
self.interpolate = v.into();
self
}
pub fn set_asset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.asset_id = v.into();
self
}
pub fn set_travel_mode<T: std::convert::Into<crate::model::TravelMode>>(
mut self,
v: T,
) -> Self {
self.travel_mode = v.into();
self
}
}
impl wkt::message::Message for SnapToRoadsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.roads.v1op.SnapToRoadsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SnappedPoint {
pub location: std::option::Option<google_cloud_type::model::LatLng>,
pub original_index: std::option::Option<wkt::UInt32Value>,
pub place_id: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SnappedPoint {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_location<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_type::model::LatLng>,
{
self.location = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_location<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<google_cloud_type::model::LatLng>,
{
self.location = v.map(|x| x.into());
self
}
pub fn set_original_index<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.original_index = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_original_index<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::UInt32Value>,
{
self.original_index = v.map(|x| x.into());
self
}
pub fn set_place_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.place_id = v.into();
self
}
}
impl wkt::message::Message for SnappedPoint {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.roads.v1op.SnappedPoint"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SnapToRoadsResponse {
pub snapped_points: std::vec::Vec<crate::model::SnappedPoint>,
pub warning_message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl SnapToRoadsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_snapped_points<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SnappedPoint>,
{
use std::iter::Iterator;
self.snapped_points = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_warning_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.warning_message = v.into();
self
}
}
impl wkt::message::Message for SnapToRoadsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.roads.v1op.SnapToRoadsResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNearestRoadsRequest {
pub points: std::string::String,
pub travel_mode: crate::model::TravelMode,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNearestRoadsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_points<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.points = v.into();
self
}
pub fn set_travel_mode<T: std::convert::Into<crate::model::TravelMode>>(
mut self,
v: T,
) -> Self {
self.travel_mode = v.into();
self
}
}
impl wkt::message::Message for ListNearestRoadsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.roads.v1op.ListNearestRoadsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListNearestRoadsResponse {
pub snapped_points: std::vec::Vec<crate::model::SnappedPoint>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListNearestRoadsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_snapped_points<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::SnappedPoint>,
{
use std::iter::Iterator;
self.snapped_points = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for ListNearestRoadsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.roads.v1op.ListNearestRoadsResponse"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TravelMode {
#[allow(missing_docs)]
Unspecified,
#[allow(missing_docs)]
Driving,
#[allow(missing_docs)]
Cycling,
#[allow(missing_docs)]
Walking,
UnknownValue(travel_mode::UnknownValue),
}
#[doc(hidden)]
pub mod travel_mode {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl TravelMode {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Driving => std::option::Option::Some(1),
Self::Cycling => std::option::Option::Some(2),
Self::Walking => std::option::Option::Some(3),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("TRAVEL_MODE_UNSPECIFIED"),
Self::Driving => std::option::Option::Some("DRIVING"),
Self::Cycling => std::option::Option::Some("CYCLING"),
Self::Walking => std::option::Option::Some("WALKING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for TravelMode {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for TravelMode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
wkt::internal::display_enum(f, self.name(), self.value())
}
}
impl std::convert::From<i32> for TravelMode {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Driving,
2 => Self::Cycling,
3 => Self::Walking,
_ => Self::UnknownValue(travel_mode::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for TravelMode {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"TRAVEL_MODE_UNSPECIFIED" => Self::Unspecified,
"DRIVING" => Self::Driving,
"CYCLING" => Self::Cycling,
"WALKING" => Self::Walking,
_ => Self::UnknownValue(travel_mode::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for TravelMode {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Unspecified => serializer.serialize_i32(0),
Self::Driving => serializer.serialize_i32(1),
Self::Cycling => serializer.serialize_i32(2),
Self::Walking => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for TravelMode {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<TravelMode>::new(
".google.maps.roads.v1op.TravelMode",
))
}
}