#![allow(clippy::doc_overindented_list_items)]
#![allow(clippy::doc_lazy_continuation)]
use core::fmt::Display;
include!("./google.type.rs");
#[cfg(feature = "serde")]
mod common_serde_impls;
#[cfg(feature = "cel")]
mod cel_common_types_impls;
#[cfg(feature = "latlng")]
pub mod latlng;
#[cfg(feature = "color")]
pub mod color;
#[cfg(feature = "date")]
pub mod date;
#[cfg(feature = "datetime")]
pub mod datetime;
#[cfg(feature = "decimal")]
pub mod decimal;
#[cfg(feature = "fraction")]
pub mod fraction;
#[cfg(feature = "interval")]
pub mod interval;
#[cfg(feature = "localized_text")]
mod localized_text;
#[cfg(feature = "money")]
pub mod money;
#[cfg(feature = "postal_address")]
mod postal_address;
#[cfg(feature = "timeofday")]
pub mod time_of_day;
#[cfg(feature = "phone_number")]
impl PhoneNumber {
#[must_use]
#[inline]
pub const fn new(extension: crate::String, kind: phone_number::Kind) -> Self {
Self {
extension,
kind: Some(kind),
}
}
#[must_use]
#[inline]
pub const fn has_kind(&self) -> bool {
self.kind.is_some()
}
}
impl CalendarPeriod {
#[must_use]
#[inline]
pub const fn is_unspecified(&self) -> bool {
matches!(self, Self::Unspecified)
}
#[must_use]
#[inline]
pub const fn is_day(&self) -> bool {
matches!(self, Self::Day)
}
#[must_use]
#[inline]
pub const fn is_week(&self) -> bool {
matches!(self, Self::Week)
}
#[must_use]
#[inline]
pub const fn is_fortnight(&self) -> bool {
matches!(self, Self::Fortnight)
}
#[inline]
#[must_use]
pub const fn is_month(&self) -> bool {
matches!(self, Self::Month)
}
#[must_use]
#[inline]
pub const fn is_quarter(&self) -> bool {
matches!(self, Self::Quarter)
}
#[must_use]
#[inline]
pub const fn is_half(&self) -> bool {
matches!(self, Self::Half)
}
#[must_use]
#[inline]
pub const fn is_year(&self) -> bool {
matches!(self, Self::Year)
}
}
impl DayOfWeek {
#[must_use]
#[inline]
pub const fn is_unspecified(&self) -> bool {
matches!(self, Self::Unspecified)
}
#[must_use]
#[inline]
pub const fn is_monday(&self) -> bool {
matches!(self, Self::Monday)
}
#[must_use]
#[inline]
pub const fn is_tuesday(&self) -> bool {
matches!(self, Self::Tuesday)
}
#[must_use]
#[inline]
pub const fn is_wednesday(&self) -> bool {
matches!(self, Self::Wednesday)
}
#[must_use]
#[inline]
pub const fn is_thursday(&self) -> bool {
matches!(self, Self::Thursday)
}
#[must_use]
#[inline]
pub const fn is_friday(&self) -> bool {
matches!(self, Self::Friday)
}
#[must_use]
#[inline]
pub const fn is_saturday(&self) -> bool {
matches!(self, Self::Saturday)
}
#[must_use]
#[inline]
pub const fn is_sunday(&self) -> bool {
matches!(self, Self::Sunday)
}
#[must_use]
#[inline]
pub const fn as_title_case(&self) -> &'static str {
match self {
Self::Unspecified => "Unspecified",
Self::Monday => "Monday",
Self::Tuesday => "Tuesday",
Self::Wednesday => "Wednesday",
Self::Thursday => "Thursday",
Self::Friday => "Friday",
Self::Saturday => "Saturday",
Self::Sunday => "Sunday",
}
}
}
impl Month {
#[must_use]
#[inline]
pub const fn is_unspecified(&self) -> bool {
matches!(self, Self::Unspecified)
}
#[must_use]
#[inline]
pub const fn is_january(&self) -> bool {
matches!(self, Self::January)
}
#[must_use]
#[inline]
pub const fn is_february(&self) -> bool {
matches!(self, Self::February)
}
#[must_use]
#[inline]
pub const fn is_march(&self) -> bool {
matches!(self, Self::March)
}
#[must_use]
#[inline]
pub const fn is_april(&self) -> bool {
matches!(self, Self::April)
}
#[must_use]
#[inline]
pub const fn is_may(&self) -> bool {
matches!(self, Self::May)
}
#[must_use]
#[inline]
pub const fn is_june(&self) -> bool {
matches!(self, Self::June)
}
#[must_use]
#[inline]
pub const fn is_july(&self) -> bool {
matches!(self, Self::July)
}
#[must_use]
#[inline]
pub const fn is_august(&self) -> bool {
matches!(self, Self::August)
}
#[must_use]
#[inline]
pub const fn is_september(&self) -> bool {
matches!(self, Self::September)
}
#[must_use]
#[inline]
pub const fn is_october(&self) -> bool {
matches!(self, Self::October)
}
#[must_use]
#[inline]
pub const fn is_november(&self) -> bool {
matches!(self, Self::November)
}
#[must_use]
#[inline]
pub const fn is_december(&self) -> bool {
matches!(self, Self::December)
}
#[must_use]
#[inline]
pub const fn as_title_case(&self) -> &'static str {
match self {
Self::Unspecified => "Unspecified",
Self::January => "January",
Self::February => "February",
Self::March => "March",
Self::April => "April",
Self::May => "May",
Self::June => "June",
Self::July => "July",
Self::August => "August",
Self::September => "September",
Self::October => "October",
Self::November => "November",
Self::December => "December",
}
}
}
impl Display for DayOfWeek {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_title_case())
}
}
impl Display for Month {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
write!(f, "{}", self.as_title_case())
}
}