#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate wkt;
mod debug;
mod deserialize;
mod serialize;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Color {
pub red: f32,
pub green: f32,
pub blue: f32,
pub alpha: std::option::Option<wkt::FloatValue>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Color {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_red<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.red = v.into();
self
}
pub fn set_green<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.green = v.into();
self
}
pub fn set_blue<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
self.blue = v.into();
self
}
pub fn set_alpha<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::FloatValue>,
{
self.alpha = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_alpha<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::FloatValue>,
{
self.alpha = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Color {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Color"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Date {
pub year: i32,
pub month: i32,
pub day: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Date {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_year<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.year = v.into();
self
}
pub fn set_month<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.month = v.into();
self
}
pub fn set_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.day = v.into();
self
}
}
impl wkt::message::Message for Date {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Date"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DateTime {
pub year: i32,
pub month: i32,
pub day: i32,
pub hours: i32,
pub minutes: i32,
pub seconds: i32,
pub nanos: i32,
pub time_offset: std::option::Option<crate::model::date_time::TimeOffset>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DateTime {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_year<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.year = v.into();
self
}
pub fn set_month<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.month = v.into();
self
}
pub fn set_day<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.day = v.into();
self
}
pub fn set_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.hours = v.into();
self
}
pub fn set_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.minutes = v.into();
self
}
pub fn set_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.seconds = v.into();
self
}
pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.nanos = v.into();
self
}
pub fn set_time_offset<
T: std::convert::Into<std::option::Option<crate::model::date_time::TimeOffset>>,
>(
mut self,
v: T,
) -> Self {
self.time_offset = v.into();
self
}
pub fn utc_offset(&self) -> std::option::Option<&std::boxed::Box<wkt::Duration>> {
#[allow(unreachable_patterns)]
self.time_offset.as_ref().and_then(|v| match v {
crate::model::date_time::TimeOffset::UtcOffset(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_utc_offset<T: std::convert::Into<std::boxed::Box<wkt::Duration>>>(
mut self,
v: T,
) -> Self {
self.time_offset =
std::option::Option::Some(crate::model::date_time::TimeOffset::UtcOffset(v.into()));
self
}
pub fn time_zone(&self) -> std::option::Option<&std::boxed::Box<crate::model::TimeZone>> {
#[allow(unreachable_patterns)]
self.time_offset.as_ref().and_then(|v| match v {
crate::model::date_time::TimeOffset::TimeZone(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_time_zone<T: std::convert::Into<std::boxed::Box<crate::model::TimeZone>>>(
mut self,
v: T,
) -> Self {
self.time_offset =
std::option::Option::Some(crate::model::date_time::TimeOffset::TimeZone(v.into()));
self
}
}
impl wkt::message::Message for DateTime {
fn typename() -> &'static str {
"type.googleapis.com/google.type.DateTime"
}
}
pub mod date_time {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum TimeOffset {
UtcOffset(std::boxed::Box<wkt::Duration>),
TimeZone(std::boxed::Box<crate::model::TimeZone>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TimeZone {
pub id: std::string::String,
pub version: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TimeZone {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.id = v.into();
self
}
pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.version = v.into();
self
}
}
impl wkt::message::Message for TimeZone {
fn typename() -> &'static str {
"type.googleapis.com/google.type.TimeZone"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Decimal {
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Decimal {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.value = v.into();
self
}
}
impl wkt::message::Message for Decimal {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Decimal"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Expr {
pub expression: std::string::String,
pub title: std::string::String,
pub description: std::string::String,
pub location: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Expr {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_expression<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.expression = v.into();
self
}
pub fn set_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.title = 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_location<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.location = v.into();
self
}
}
impl wkt::message::Message for Expr {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Expr"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Fraction {
pub numerator: i64,
pub denominator: i64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Fraction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_numerator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.numerator = v.into();
self
}
pub fn set_denominator<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.denominator = v.into();
self
}
}
impl wkt::message::Message for Fraction {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Fraction"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Interval {
pub start_time: std::option::Option<wkt::Timestamp>,
pub end_time: std::option::Option<wkt::Timestamp>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Interval {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_start_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.start_time = v.map(|x| x.into());
self
}
pub fn set_end_time<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Timestamp>,
{
self.end_time = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Interval {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Interval"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LatLng {
pub latitude: f64,
pub longitude: f64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LatLng {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_latitude<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.latitude = v.into();
self
}
pub fn set_longitude<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.longitude = v.into();
self
}
}
impl wkt::message::Message for LatLng {
fn typename() -> &'static str {
"type.googleapis.com/google.type.LatLng"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocalizedText {
pub text: std::string::String,
pub language_code: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocalizedText {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
}
impl wkt::message::Message for LocalizedText {
fn typename() -> &'static str {
"type.googleapis.com/google.type.LocalizedText"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Money {
pub currency_code: std::string::String,
pub units: i64,
pub nanos: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Money {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_currency_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.currency_code = v.into();
self
}
pub fn set_units<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.units = v.into();
self
}
pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.nanos = v.into();
self
}
}
impl wkt::message::Message for Money {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Money"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PhoneNumber {
pub extension: std::string::String,
pub kind: std::option::Option<crate::model::phone_number::Kind>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PhoneNumber {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_extension<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.extension = v.into();
self
}
pub fn set_kind<
T: std::convert::Into<std::option::Option<crate::model::phone_number::Kind>>,
>(
mut self,
v: T,
) -> Self {
self.kind = v.into();
self
}
pub fn e164_number(&self) -> std::option::Option<&std::string::String> {
#[allow(unreachable_patterns)]
self.kind.as_ref().and_then(|v| match v {
crate::model::phone_number::Kind::E164Number(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_e164_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.kind =
std::option::Option::Some(crate::model::phone_number::Kind::E164Number(v.into()));
self
}
pub fn short_code(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::phone_number::ShortCode>> {
#[allow(unreachable_patterns)]
self.kind.as_ref().and_then(|v| match v {
crate::model::phone_number::Kind::ShortCode(v) => std::option::Option::Some(v),
_ => std::option::Option::None,
})
}
pub fn set_short_code<
T: std::convert::Into<std::boxed::Box<crate::model::phone_number::ShortCode>>,
>(
mut self,
v: T,
) -> Self {
self.kind =
std::option::Option::Some(crate::model::phone_number::Kind::ShortCode(v.into()));
self
}
}
impl wkt::message::Message for PhoneNumber {
fn typename() -> &'static str {
"type.googleapis.com/google.type.PhoneNumber"
}
}
pub mod phone_number {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ShortCode {
pub region_code: std::string::String,
pub number: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ShortCode {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.region_code = v.into();
self
}
pub fn set_number<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.number = v.into();
self
}
}
impl wkt::message::Message for ShortCode {
fn typename() -> &'static str {
"type.googleapis.com/google.type.PhoneNumber.ShortCode"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Kind {
E164Number(std::string::String),
ShortCode(std::boxed::Box<crate::model::phone_number::ShortCode>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PostalAddress {
pub revision: i32,
pub region_code: std::string::String,
pub language_code: std::string::String,
pub postal_code: std::string::String,
pub sorting_code: std::string::String,
pub administrative_area: std::string::String,
pub locality: std::string::String,
pub sublocality: std::string::String,
pub address_lines: std::vec::Vec<std::string::String>,
pub recipients: std::vec::Vec<std::string::String>,
pub organization: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PostalAddress {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.revision = v.into();
self
}
pub fn set_region_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.region_code = v.into();
self
}
pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.language_code = v.into();
self
}
pub fn set_postal_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.postal_code = v.into();
self
}
pub fn set_sorting_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sorting_code = v.into();
self
}
pub fn set_administrative_area<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.administrative_area = v.into();
self
}
pub fn set_locality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.locality = v.into();
self
}
pub fn set_sublocality<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.sublocality = v.into();
self
}
pub fn set_address_lines<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.address_lines = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_recipients<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.recipients = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_organization<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.organization = v.into();
self
}
}
impl wkt::message::Message for PostalAddress {
fn typename() -> &'static str {
"type.googleapis.com/google.type.PostalAddress"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Quaternion {
pub x: f64,
pub y: f64,
pub z: f64,
pub w: f64,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Quaternion {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_x<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.x = v.into();
self
}
pub fn set_y<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.y = v.into();
self
}
pub fn set_z<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.z = v.into();
self
}
pub fn set_w<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
self.w = v.into();
self
}
}
impl wkt::message::Message for Quaternion {
fn typename() -> &'static str {
"type.googleapis.com/google.type.Quaternion"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct TimeOfDay {
pub hours: i32,
pub minutes: i32,
pub seconds: i32,
pub nanos: i32,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl TimeOfDay {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_hours<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.hours = v.into();
self
}
pub fn set_minutes<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.minutes = v.into();
self
}
pub fn set_seconds<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.seconds = v.into();
self
}
pub fn set_nanos<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.nanos = v.into();
self
}
}
impl wkt::message::Message for TimeOfDay {
fn typename() -> &'static str {
"type.googleapis.com/google.type.TimeOfDay"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum CalendarPeriod {
Unspecified,
Day,
Week,
Fortnight,
Month,
Quarter,
Half,
Year,
UnknownValue(calendar_period::UnknownValue),
}
#[doc(hidden)]
pub mod calendar_period {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl CalendarPeriod {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Day => std::option::Option::Some(1),
Self::Week => std::option::Option::Some(2),
Self::Fortnight => std::option::Option::Some(3),
Self::Month => std::option::Option::Some(4),
Self::Quarter => std::option::Option::Some(5),
Self::Half => std::option::Option::Some(6),
Self::Year => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("CALENDAR_PERIOD_UNSPECIFIED"),
Self::Day => std::option::Option::Some("DAY"),
Self::Week => std::option::Option::Some("WEEK"),
Self::Fortnight => std::option::Option::Some("FORTNIGHT"),
Self::Month => std::option::Option::Some("MONTH"),
Self::Quarter => std::option::Option::Some("QUARTER"),
Self::Half => std::option::Option::Some("HALF"),
Self::Year => std::option::Option::Some("YEAR"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for CalendarPeriod {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for CalendarPeriod {
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 CalendarPeriod {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Day,
2 => Self::Week,
3 => Self::Fortnight,
4 => Self::Month,
5 => Self::Quarter,
6 => Self::Half,
7 => Self::Year,
_ => Self::UnknownValue(calendar_period::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for CalendarPeriod {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"CALENDAR_PERIOD_UNSPECIFIED" => Self::Unspecified,
"DAY" => Self::Day,
"WEEK" => Self::Week,
"FORTNIGHT" => Self::Fortnight,
"MONTH" => Self::Month,
"QUARTER" => Self::Quarter,
"HALF" => Self::Half,
"YEAR" => Self::Year,
_ => Self::UnknownValue(calendar_period::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for CalendarPeriod {
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::Day => serializer.serialize_i32(1),
Self::Week => serializer.serialize_i32(2),
Self::Fortnight => serializer.serialize_i32(3),
Self::Month => serializer.serialize_i32(4),
Self::Quarter => serializer.serialize_i32(5),
Self::Half => serializer.serialize_i32(6),
Self::Year => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for CalendarPeriod {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<CalendarPeriod>::new(
".google.type.CalendarPeriod",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DayOfWeek {
Unspecified,
Monday,
Tuesday,
Wednesday,
Thursday,
Friday,
Saturday,
Sunday,
UnknownValue(day_of_week::UnknownValue),
}
#[doc(hidden)]
pub mod day_of_week {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DayOfWeek {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::Monday => std::option::Option::Some(1),
Self::Tuesday => std::option::Option::Some(2),
Self::Wednesday => std::option::Option::Some(3),
Self::Thursday => std::option::Option::Some(4),
Self::Friday => std::option::Option::Some(5),
Self::Saturday => std::option::Option::Some(6),
Self::Sunday => std::option::Option::Some(7),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("DAY_OF_WEEK_UNSPECIFIED"),
Self::Monday => std::option::Option::Some("MONDAY"),
Self::Tuesday => std::option::Option::Some("TUESDAY"),
Self::Wednesday => std::option::Option::Some("WEDNESDAY"),
Self::Thursday => std::option::Option::Some("THURSDAY"),
Self::Friday => std::option::Option::Some("FRIDAY"),
Self::Saturday => std::option::Option::Some("SATURDAY"),
Self::Sunday => std::option::Option::Some("SUNDAY"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DayOfWeek {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DayOfWeek {
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 DayOfWeek {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::Monday,
2 => Self::Tuesday,
3 => Self::Wednesday,
4 => Self::Thursday,
5 => Self::Friday,
6 => Self::Saturday,
7 => Self::Sunday,
_ => Self::UnknownValue(day_of_week::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DayOfWeek {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"DAY_OF_WEEK_UNSPECIFIED" => Self::Unspecified,
"MONDAY" => Self::Monday,
"TUESDAY" => Self::Tuesday,
"WEDNESDAY" => Self::Wednesday,
"THURSDAY" => Self::Thursday,
"FRIDAY" => Self::Friday,
"SATURDAY" => Self::Saturday,
"SUNDAY" => Self::Sunday,
_ => Self::UnknownValue(day_of_week::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DayOfWeek {
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::Monday => serializer.serialize_i32(1),
Self::Tuesday => serializer.serialize_i32(2),
Self::Wednesday => serializer.serialize_i32(3),
Self::Thursday => serializer.serialize_i32(4),
Self::Friday => serializer.serialize_i32(5),
Self::Saturday => serializer.serialize_i32(6),
Self::Sunday => serializer.serialize_i32(7),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DayOfWeek {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DayOfWeek>::new(
".google.type.DayOfWeek",
))
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Month {
Unspecified,
January,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December,
UnknownValue(month::UnknownValue),
}
#[doc(hidden)]
pub mod month {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Month {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::January => std::option::Option::Some(1),
Self::February => std::option::Option::Some(2),
Self::March => std::option::Option::Some(3),
Self::April => std::option::Option::Some(4),
Self::May => std::option::Option::Some(5),
Self::June => std::option::Option::Some(6),
Self::July => std::option::Option::Some(7),
Self::August => std::option::Option::Some(8),
Self::September => std::option::Option::Some(9),
Self::October => std::option::Option::Some(10),
Self::November => std::option::Option::Some(11),
Self::December => std::option::Option::Some(12),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("MONTH_UNSPECIFIED"),
Self::January => std::option::Option::Some("JANUARY"),
Self::February => std::option::Option::Some("FEBRUARY"),
Self::March => std::option::Option::Some("MARCH"),
Self::April => std::option::Option::Some("APRIL"),
Self::May => std::option::Option::Some("MAY"),
Self::June => std::option::Option::Some("JUNE"),
Self::July => std::option::Option::Some("JULY"),
Self::August => std::option::Option::Some("AUGUST"),
Self::September => std::option::Option::Some("SEPTEMBER"),
Self::October => std::option::Option::Some("OCTOBER"),
Self::November => std::option::Option::Some("NOVEMBER"),
Self::December => std::option::Option::Some("DECEMBER"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Month {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Month {
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 Month {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::January,
2 => Self::February,
3 => Self::March,
4 => Self::April,
5 => Self::May,
6 => Self::June,
7 => Self::July,
8 => Self::August,
9 => Self::September,
10 => Self::October,
11 => Self::November,
12 => Self::December,
_ => Self::UnknownValue(month::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Month {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"MONTH_UNSPECIFIED" => Self::Unspecified,
"JANUARY" => Self::January,
"FEBRUARY" => Self::February,
"MARCH" => Self::March,
"APRIL" => Self::April,
"MAY" => Self::May,
"JUNE" => Self::June,
"JULY" => Self::July,
"AUGUST" => Self::August,
"SEPTEMBER" => Self::September,
"OCTOBER" => Self::October,
"NOVEMBER" => Self::November,
"DECEMBER" => Self::December,
_ => Self::UnknownValue(month::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for Month {
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::January => serializer.serialize_i32(1),
Self::February => serializer.serialize_i32(2),
Self::March => serializer.serialize_i32(3),
Self::April => serializer.serialize_i32(4),
Self::May => serializer.serialize_i32(5),
Self::June => serializer.serialize_i32(6),
Self::July => serializer.serialize_i32(7),
Self::August => serializer.serialize_i32(8),
Self::September => serializer.serialize_i32(9),
Self::October => serializer.serialize_i32(10),
Self::November => serializer.serialize_i32(11),
Self::December => serializer.serialize_i32(12),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Month {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Month>::new(
".google.type.Month",
))
}
}