#![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_rpc;
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 LocalFileSource {
pub filename: std::string::String,
pub file_format: crate::model::FileFormat,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocalFileSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_filename<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.filename = v.into();
self
}
pub fn set_file_format<T: std::convert::Into<crate::model::FileFormat>>(
mut self,
v: T,
) -> Self {
self.file_format = v.into();
self
}
}
impl wkt::message::Message for LocalFileSource {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.LocalFileSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GcsSource {
pub input_uri: std::string::String,
pub file_format: crate::model::FileFormat,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GcsSource {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_input_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.input_uri = v.into();
self
}
pub fn set_file_format<T: std::convert::Into<crate::model::FileFormat>>(
mut self,
v: T,
) -> Self {
self.file_format = v.into();
self
}
}
impl wkt::message::Message for GcsSource {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.GcsSource"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Dataset {
pub name: std::string::String,
pub display_name: std::string::String,
pub description: std::string::String,
pub version_id: std::string::String,
pub usage: std::vec::Vec<crate::model::Usage>,
pub status: std::option::Option<crate::model::Status>,
pub create_time: std::option::Option<wkt::Timestamp>,
pub update_time: std::option::Option<wkt::Timestamp>,
pub version_create_time: std::option::Option<wkt::Timestamp>,
pub version_description: std::string::String,
pub data_source: std::option::Option<crate::model::dataset::DataSource>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Dataset {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.display_name = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_version_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version_id = v.into();
self
}
pub fn set_usage<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Usage>,
{
use std::iter::Iterator;
self.usage = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_status<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Status>,
{
self.status = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Status>,
{
self.status = v.map(|x| x.into());
self
}
pub fn set_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.create_time = v.map(|x| x.into());
self
}
pub fn set_update_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.update_time = v.map(|x| x.into());
self
}
pub fn set_version_create_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.version_create_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_version_create_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.version_create_time = v.map(|x| x.into());
self
}
pub fn set_version_description<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.version_description = v.into();
self
}
pub fn set_data_source<
T: std::convert::Into<std::option::Option<crate::model::dataset::DataSource>>,
>(
mut self,
v: T,
) -> Self {
self.data_source = v.into();
self
}
pub fn local_file_source(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::LocalFileSource>> {
#[allow(unreachable_patterns)]
self.data_source.as_ref().and_then(|v| match v {
crate::model::dataset::DataSource::LocalFileSource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_local_file_source<
T: std::convert::Into<std::boxed::Box<crate::model::LocalFileSource>>,
>(
mut self,
v: T,
) -> Self {
self.data_source =
std::option::Option::Some(crate::model::dataset::DataSource::LocalFileSource(v.into()));
self
}
pub fn gcs_source(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsSource>> {
#[allow(unreachable_patterns)]
self.data_source.as_ref().and_then(|v| match v {
crate::model::dataset::DataSource::GcsSource(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_gcs_source<T: std::convert::Into<std::boxed::Box<crate::model::GcsSource>>>(
mut self,
v: T,
) -> Self {
self.data_source =
std::option::Option::Some(crate::model::dataset::DataSource::GcsSource(v.into()));
self
}
}
impl wkt::message::Message for Dataset {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.Dataset"
}
}
pub mod dataset {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DataSource {
LocalFileSource(std::boxed::Box<crate::model::LocalFileSource>),
GcsSource(std::boxed::Box<crate::model::GcsSource>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Status {
pub state: crate::model::status::State,
pub error_message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Status {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_state<T: std::convert::Into<crate::model::status::State>>(mut self, v: T) -> Self {
self.state = v.into();
self
}
pub fn set_error_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.error_message = v.into();
self
}
}
impl wkt::message::Message for Status {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.Status"
}
}
pub mod status {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum State {
Unspecified,
Importing,
ImportSucceeded,
ImportFailed,
Deleting,
DeletionFailed,
Processing,
ProcessingFailed,
NeedsReview,
Publishing,
PublishingFailed,
Completed,
UnknownValue(state::UnknownValue),
}
#[doc(hidden)]
pub mod state {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl State {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Importing => std::option::Option::Some(1),
Self::ImportSucceeded => std::option::Option::Some(2),
Self::ImportFailed => std::option::Option::Some(3),
Self::Deleting => std::option::Option::Some(4),
Self::DeletionFailed => std::option::Option::Some(5),
Self::Processing => std::option::Option::Some(6),
Self::ProcessingFailed => std::option::Option::Some(7),
Self::NeedsReview => std::option::Option::Some(8),
Self::Publishing => std::option::Option::Some(9),
Self::PublishingFailed => std::option::Option::Some(10),
Self::Completed => std::option::Option::Some(11),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
Self::Importing => std::option::Option::Some("STATE_IMPORTING"),
Self::ImportSucceeded => std::option::Option::Some("STATE_IMPORT_SUCCEEDED"),
Self::ImportFailed => std::option::Option::Some("STATE_IMPORT_FAILED"),
Self::Deleting => std::option::Option::Some("STATE_DELETING"),
Self::DeletionFailed => std::option::Option::Some("STATE_DELETION_FAILED"),
Self::Processing => std::option::Option::Some("STATE_PROCESSING"),
Self::ProcessingFailed => std::option::Option::Some("STATE_PROCESSING_FAILED"),
Self::NeedsReview => std::option::Option::Some("STATE_NEEDS_REVIEW"),
Self::Publishing => std::option::Option::Some("STATE_PUBLISHING"),
Self::PublishingFailed => std::option::Option::Some("STATE_PUBLISHING_FAILED"),
Self::Completed => std::option::Option::Some("STATE_COMPLETED"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for State {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for State {
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 State {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Importing,
2 => Self::ImportSucceeded,
3 => Self::ImportFailed,
4 => Self::Deleting,
5 => Self::DeletionFailed,
6 => Self::Processing,
7 => Self::ProcessingFailed,
8 => Self::NeedsReview,
9 => Self::Publishing,
10 => Self::PublishingFailed,
11 => Self::Completed,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for State {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"STATE_UNSPECIFIED" => Self::Unspecified,
"STATE_IMPORTING" => Self::Importing,
"STATE_IMPORT_SUCCEEDED" => Self::ImportSucceeded,
"STATE_IMPORT_FAILED" => Self::ImportFailed,
"STATE_DELETING" => Self::Deleting,
"STATE_DELETION_FAILED" => Self::DeletionFailed,
"STATE_PROCESSING" => Self::Processing,
"STATE_PROCESSING_FAILED" => Self::ProcessingFailed,
"STATE_NEEDS_REVIEW" => Self::NeedsReview,
"STATE_PUBLISHING" => Self::Publishing,
"STATE_PUBLISHING_FAILED" => Self::PublishingFailed,
"STATE_COMPLETED" => Self::Completed,
_ => Self::UnknownValue(state::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for State {
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::Importing => serializer.serialize_i32(1),
Self::ImportSucceeded => serializer.serialize_i32(2),
Self::ImportFailed => serializer.serialize_i32(3),
Self::Deleting => serializer.serialize_i32(4),
Self::DeletionFailed => serializer.serialize_i32(5),
Self::Processing => serializer.serialize_i32(6),
Self::ProcessingFailed => serializer.serialize_i32(7),
Self::NeedsReview => serializer.serialize_i32(8),
Self::Publishing => serializer.serialize_i32(9),
Self::PublishingFailed => serializer.serialize_i32(10),
Self::Completed => serializer.serialize_i32(11),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for State {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
".google.maps.mapsplatformdatasets.v1.Status.State",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CreateDatasetRequest {
pub parent: std::string::String,
pub dataset: std::option::Option<crate::model::Dataset>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl CreateDatasetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for CreateDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.CreateDatasetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UpdateDatasetMetadataRequest {
pub dataset: std::option::Option<crate::model::Dataset>,
pub update_mask: std::option::Option<wkt::FieldMask>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UpdateDatasetMetadataRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_dataset<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_dataset<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::Dataset>,
{
self.dataset = v.map(|x| x.into());
self
}
pub fn set_update_mask<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FieldMask>,
{
self.update_mask = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for UpdateDatasetMetadataRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.UpdateDatasetMetadataRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct GetDatasetRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GetDatasetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for GetDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.GetDatasetRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDatasetsRequest {
pub parent: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub tag: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListDatasetsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.parent = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
pub fn set_tag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.tag = v.into();
self
}
}
impl wkt::message::Message for ListDatasetsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.ListDatasetsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ListDatasetsResponse {
pub datasets: std::vec::Vec<crate::model::Dataset>,
pub next_page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ListDatasetsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_datasets<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::Dataset>,
{
use std::iter::Iterator;
self.datasets = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
}
impl wkt::message::Message for ListDatasetsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.ListDatasetsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for ListDatasetsResponse {
type PageItem = crate::model::Dataset;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.datasets
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FetchDatasetErrorsRequest {
pub dataset: std::string::String,
pub page_size: i32,
pub page_token: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FetchDatasetErrorsRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_dataset<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.dataset = v.into();
self
}
pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.page_size = v.into();
self
}
pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.page_token = v.into();
self
}
}
impl wkt::message::Message for FetchDatasetErrorsRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.FetchDatasetErrorsRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FetchDatasetErrorsResponse {
pub next_page_token: std::string::String,
pub errors: std::vec::Vec<google_cloud_rpc::model::Status>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FetchDatasetErrorsResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.next_page_token = v.into();
self
}
pub fn set_errors<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_rpc::model::Status>,
{
use std::iter::Iterator;
self.errors = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for FetchDatasetErrorsResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.FetchDatasetErrorsResponse"
}
}
#[doc(hidden)]
impl google_cloud_gax::paginator::internal::PageableResponse for FetchDatasetErrorsResponse {
type PageItem = google_cloud_rpc::model::Status;
fn items(self) -> std::vec::Vec<Self::PageItem> {
self.errors
}
fn next_page_token(&self) -> std::string::String {
use std::clone::Clone;
self.next_page_token.clone()
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DeleteDatasetRequest {
pub name: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DeleteDatasetRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
}
impl wkt::message::Message for DeleteDatasetRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.maps.mapsplatformdatasets.v1.DeleteDatasetRequest"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum FileFormat {
Unspecified,
Geojson,
Kml,
Csv,
UnknownValue(file_format::UnknownValue),
}
#[doc(hidden)]
pub mod file_format {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl FileFormat {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Geojson => std::option::Option::Some(1),
Self::Kml => std::option::Option::Some(2),
Self::Csv => 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("FILE_FORMAT_UNSPECIFIED"),
Self::Geojson => std::option::Option::Some("FILE_FORMAT_GEOJSON"),
Self::Kml => std::option::Option::Some("FILE_FORMAT_KML"),
Self::Csv => std::option::Option::Some("FILE_FORMAT_CSV"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for FileFormat {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for FileFormat {
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 FileFormat {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Geojson,
2 => Self::Kml,
3 => Self::Csv,
_ => Self::UnknownValue(file_format::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for FileFormat {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"FILE_FORMAT_UNSPECIFIED" => Self::Unspecified,
"FILE_FORMAT_GEOJSON" => Self::Geojson,
"FILE_FORMAT_KML" => Self::Kml,
"FILE_FORMAT_CSV" => Self::Csv,
_ => Self::UnknownValue(file_format::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for FileFormat {
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::Geojson => serializer.serialize_i32(1),
Self::Kml => serializer.serialize_i32(2),
Self::Csv => serializer.serialize_i32(3),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for FileFormat {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<FileFormat>::new(
".google.maps.mapsplatformdatasets.v1.FileFormat",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Usage {
Unspecified,
DataDrivenStyling,
UnknownValue(usage::UnknownValue),
}
#[doc(hidden)]
pub mod usage {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Usage {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::DataDrivenStyling => std::option::Option::Some(1),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("USAGE_UNSPECIFIED"),
Self::DataDrivenStyling => std::option::Option::Some("USAGE_DATA_DRIVEN_STYLING"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Usage {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Usage {
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 Usage {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::DataDrivenStyling,
_ => Self::UnknownValue(usage::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Usage {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"USAGE_UNSPECIFIED" => Self::Unspecified,
"USAGE_DATA_DRIVEN_STYLING" => Self::DataDrivenStyling,
_ => Self::UnknownValue(usage::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Usage {
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::DataDrivenStyling => serializer.serialize_i32(1),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Usage {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Usage>::new(
".google.maps.mapsplatformdatasets.v1.Usage",
))
}
}