#![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 ErrorInfo {
pub reason: std::string::String,
pub domain: std::string::String,
pub metadata: std::collections::HashMap<std::string::String, std::string::String>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ErrorInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reason = v.into();
self
}
pub fn set_domain<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.domain = v.into();
self
}
pub fn set_metadata<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
}
impl wkt::message::Message for ErrorInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.ErrorInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RetryInfo {
pub retry_delay: std::option::Option<wkt::Duration>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RetryInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_retry_delay<T>(mut self, v: T) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.retry_delay = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_retry_delay<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<wkt::Duration>,
{
self.retry_delay = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for RetryInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.RetryInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct DebugInfo {
pub stack_entries: std::vec::Vec<std::string::String>,
pub detail: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl DebugInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_stack_entries<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.stack_entries = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_detail<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.detail = v.into();
self
}
}
impl wkt::message::Message for DebugInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.DebugInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct QuotaFailure {
pub violations: std::vec::Vec<crate::model::quota_failure::Violation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl QuotaFailure {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_violations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::quota_failure::Violation>,
{
use std::iter::Iterator;
self.violations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for QuotaFailure {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.QuotaFailure"
}
}
pub mod quota_failure {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Violation {
pub subject: std::string::String,
pub description: std::string::String,
pub api_service: std::string::String,
pub quota_metric: std::string::String,
pub quota_id: std::string::String,
pub quota_dimensions: std::collections::HashMap<std::string::String, std::string::String>,
pub quota_value: i64,
pub future_quota_value: std::option::Option<i64>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Violation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.subject = 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_api_service<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.api_service = v.into();
self
}
pub fn set_quota_metric<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.quota_metric = v.into();
self
}
pub fn set_quota_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.quota_id = v.into();
self
}
pub fn set_quota_dimensions<T, K, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = (K, V)>,
K: std::convert::Into<std::string::String>,
V: std::convert::Into<std::string::String>,
{
use std::iter::Iterator;
self.quota_dimensions = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
self
}
pub fn set_quota_value<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
self.quota_value = v.into();
self
}
pub fn set_future_quota_value<T>(mut self, v: T) -> Self
where
T: std::convert::Into<i64>,
{
self.future_quota_value = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_future_quota_value<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<i64>,
{
self.future_quota_value = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for Violation {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.QuotaFailure.Violation"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct PreconditionFailure {
pub violations: std::vec::Vec<crate::model::precondition_failure::Violation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl PreconditionFailure {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_violations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::precondition_failure::Violation>,
{
use std::iter::Iterator;
self.violations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for PreconditionFailure {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.PreconditionFailure"
}
}
pub mod precondition_failure {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Violation {
pub r#type: std::string::String,
pub subject: std::string::String,
pub description: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Violation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.r#type = v.into();
self
}
pub fn set_subject<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.subject = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
}
impl wkt::message::Message for Violation {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.PreconditionFailure.Violation"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct BadRequest {
pub field_violations: std::vec::Vec<crate::model::bad_request::FieldViolation>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl BadRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_field_violations<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::bad_request::FieldViolation>,
{
use std::iter::Iterator;
self.field_violations = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for BadRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.BadRequest"
}
}
pub mod bad_request {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct FieldViolation {
pub field: std::string::String,
pub description: std::string::String,
pub reason: std::string::String,
pub localized_message: std::option::Option<crate::model::LocalizedMessage>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl FieldViolation {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_field<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.field = 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_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reason = v.into();
self
}
pub fn set_localized_message<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::LocalizedMessage>,
{
self.localized_message = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_localized_message<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::LocalizedMessage>,
{
self.localized_message = v.map(|x| x.into());
self
}
}
impl wkt::message::Message for FieldViolation {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.BadRequest.FieldViolation"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct RequestInfo {
pub request_id: std::string::String,
pub serving_data: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl RequestInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_request_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.request_id = v.into();
self
}
pub fn set_serving_data<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.serving_data = v.into();
self
}
}
impl wkt::message::Message for RequestInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.RequestInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ResourceInfo {
pub resource_type: std::string::String,
pub resource_name: std::string::String,
pub owner: std::string::String,
pub description: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ResourceInfo {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource_type = v.into();
self
}
pub fn set_resource_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.resource_name = v.into();
self
}
pub fn set_owner<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.owner = v.into();
self
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
}
impl wkt::message::Message for ResourceInfo {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.ResourceInfo"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Help {
pub links: std::vec::Vec<crate::model::help::Link>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Help {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_links<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::help::Link>,
{
use std::iter::Iterator;
self.links = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Help {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.Help"
}
}
pub mod help {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Link {
pub description: std::string::String,
pub url: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl Link {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.description = v.into();
self
}
pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.url = v.into();
self
}
}
impl wkt::message::Message for Link {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.Help.Link"
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LocalizedMessage {
pub locale: std::string::String,
pub message: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl LocalizedMessage {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_locale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.locale = v.into();
self
}
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
}
impl wkt::message::Message for LocalizedMessage {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.LocalizedMessage"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpRequest {
pub method: std::string::String,
pub uri: std::string::String,
pub headers: std::vec::Vec<crate::model::HttpHeader>,
pub body: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HttpRequest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.method = v.into();
self
}
pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.uri = v.into();
self
}
pub fn set_headers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::HttpHeader>,
{
use std::iter::Iterator;
self.headers = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.body = v.into();
self
}
}
impl wkt::message::Message for HttpRequest {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.HttpRequest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpResponse {
pub status: i32,
pub reason: std::string::String,
pub headers: std::vec::Vec<crate::model::HttpHeader>,
pub body: ::bytes::Bytes,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HttpResponse {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.status = v.into();
self
}
pub fn set_reason<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.reason = v.into();
self
}
pub fn set_headers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::HttpHeader>,
{
use std::iter::Iterator;
self.headers = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_body<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
self.body = v.into();
self
}
}
impl wkt::message::Message for HttpResponse {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.HttpResponse"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpHeader {
pub key: std::string::String,
pub value: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl HttpHeader {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.key = v.into();
self
}
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 HttpHeader {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.HttpHeader"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct Status {
pub code: i32,
pub message: std::string::String,
pub details: std::vec::Vec<wkt::Any>,
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_code<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
self.code = v.into();
self
}
pub fn set_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.message = v.into();
self
}
pub fn set_details<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<wkt::Any>,
{
use std::iter::Iterator;
self.details = v.into_iter().map(|i| i.into()).collect();
self
}
}
impl wkt::message::Message for Status {
fn typename() -> &'static str {
"type.googleapis.com/google.rpc.Status"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Code {
Ok,
Cancelled,
Unknown,
InvalidArgument,
DeadlineExceeded,
NotFound,
AlreadyExists,
PermissionDenied,
Unauthenticated,
ResourceExhausted,
FailedPrecondition,
Aborted,
OutOfRange,
Unimplemented,
Internal,
Unavailable,
DataLoss,
UnknownValue(code::UnknownValue),
}
#[doc(hidden)]
pub mod code {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl Code {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Ok => std::option::Option::Some(0),
Self::Cancelled => std::option::Option::Some(1),
Self::Unknown => std::option::Option::Some(2),
Self::InvalidArgument => std::option::Option::Some(3),
Self::DeadlineExceeded => std::option::Option::Some(4),
Self::NotFound => std::option::Option::Some(5),
Self::AlreadyExists => std::option::Option::Some(6),
Self::PermissionDenied => std::option::Option::Some(7),
Self::Unauthenticated => std::option::Option::Some(16),
Self::ResourceExhausted => std::option::Option::Some(8),
Self::FailedPrecondition => std::option::Option::Some(9),
Self::Aborted => std::option::Option::Some(10),
Self::OutOfRange => std::option::Option::Some(11),
Self::Unimplemented => std::option::Option::Some(12),
Self::Internal => std::option::Option::Some(13),
Self::Unavailable => std::option::Option::Some(14),
Self::DataLoss => std::option::Option::Some(15),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Ok => std::option::Option::Some("OK"),
Self::Cancelled => std::option::Option::Some("CANCELLED"),
Self::Unknown => std::option::Option::Some("UNKNOWN"),
Self::InvalidArgument => std::option::Option::Some("INVALID_ARGUMENT"),
Self::DeadlineExceeded => std::option::Option::Some("DEADLINE_EXCEEDED"),
Self::NotFound => std::option::Option::Some("NOT_FOUND"),
Self::AlreadyExists => std::option::Option::Some("ALREADY_EXISTS"),
Self::PermissionDenied => std::option::Option::Some("PERMISSION_DENIED"),
Self::Unauthenticated => std::option::Option::Some("UNAUTHENTICATED"),
Self::ResourceExhausted => std::option::Option::Some("RESOURCE_EXHAUSTED"),
Self::FailedPrecondition => std::option::Option::Some("FAILED_PRECONDITION"),
Self::Aborted => std::option::Option::Some("ABORTED"),
Self::OutOfRange => std::option::Option::Some("OUT_OF_RANGE"),
Self::Unimplemented => std::option::Option::Some("UNIMPLEMENTED"),
Self::Internal => std::option::Option::Some("INTERNAL"),
Self::Unavailable => std::option::Option::Some("UNAVAILABLE"),
Self::DataLoss => std::option::Option::Some("DATA_LOSS"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for Code {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for Code {
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 Code {
fn from(value: i32) -> Self {
match value {
0 => Self::Ok,
1 => Self::Cancelled,
2 => Self::Unknown,
3 => Self::InvalidArgument,
4 => Self::DeadlineExceeded,
5 => Self::NotFound,
6 => Self::AlreadyExists,
7 => Self::PermissionDenied,
8 => Self::ResourceExhausted,
9 => Self::FailedPrecondition,
10 => Self::Aborted,
11 => Self::OutOfRange,
12 => Self::Unimplemented,
13 => Self::Internal,
14 => Self::Unavailable,
15 => Self::DataLoss,
16 => Self::Unauthenticated,
_ => Self::UnknownValue(code::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for Code {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"OK" => Self::Ok,
"CANCELLED" => Self::Cancelled,
"UNKNOWN" => Self::Unknown,
"INVALID_ARGUMENT" => Self::InvalidArgument,
"DEADLINE_EXCEEDED" => Self::DeadlineExceeded,
"NOT_FOUND" => Self::NotFound,
"ALREADY_EXISTS" => Self::AlreadyExists,
"PERMISSION_DENIED" => Self::PermissionDenied,
"UNAUTHENTICATED" => Self::Unauthenticated,
"RESOURCE_EXHAUSTED" => Self::ResourceExhausted,
"FAILED_PRECONDITION" => Self::FailedPrecondition,
"ABORTED" => Self::Aborted,
"OUT_OF_RANGE" => Self::OutOfRange,
"UNIMPLEMENTED" => Self::Unimplemented,
"INTERNAL" => Self::Internal,
"UNAVAILABLE" => Self::Unavailable,
"DATA_LOSS" => Self::DataLoss,
_ => Self::UnknownValue(code::UnknownValue(wkt::internal::UnknownEnumValue::String(
value.to_string(),
))),
}
}
}
impl serde::ser::Serialize for Code {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
Self::Ok => serializer.serialize_i32(0),
Self::Cancelled => serializer.serialize_i32(1),
Self::Unknown => serializer.serialize_i32(2),
Self::InvalidArgument => serializer.serialize_i32(3),
Self::DeadlineExceeded => serializer.serialize_i32(4),
Self::NotFound => serializer.serialize_i32(5),
Self::AlreadyExists => serializer.serialize_i32(6),
Self::PermissionDenied => serializer.serialize_i32(7),
Self::Unauthenticated => serializer.serialize_i32(16),
Self::ResourceExhausted => serializer.serialize_i32(8),
Self::FailedPrecondition => serializer.serialize_i32(9),
Self::Aborted => serializer.serialize_i32(10),
Self::OutOfRange => serializer.serialize_i32(11),
Self::Unimplemented => serializer.serialize_i32(12),
Self::Internal => serializer.serialize_i32(13),
Self::Unavailable => serializer.serialize_i32(14),
Self::DataLoss => serializer.serialize_i32(15),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for Code {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<Code>::new(".google.rpc.Code"))
}
}