use crate::backup_service::*;
impl serde::Serialize for BackupJobStatus {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
let variant = match self {
Self::Unspecified => "UNSPECIFIED",
Self::Running => "RUNNING",
Self::Succeeded => "SUCCEEDED",
Self::NotFound => "NOT_FOUND",
Self::Failed => "FAILED",
};
serializer.serialize_str(variant)
}
}
impl<'de> serde::Deserialize<'de> for BackupJobStatus {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"UNSPECIFIED",
"RUNNING",
"SUCCEEDED",
"NOT_FOUND",
"FAILED",
];
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = BackupJobStatus;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
fn visit_i64<E>(self, v: i64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self)
})
}
fn visit_u64<E>(self, v: u64) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
i32::try_from(v)
.ok()
.and_then(|x| x.try_into().ok())
.ok_or_else(|| {
serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self)
})
}
fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
where
E: serde::de::Error,
{
match value {
"UNSPECIFIED" => Ok(BackupJobStatus::Unspecified),
"RUNNING" => Ok(BackupJobStatus::Running),
"SUCCEEDED" => Ok(BackupJobStatus::Succeeded),
"NOT_FOUND" => Ok(BackupJobStatus::NotFound),
"FAILED" => Ok(BackupJobStatus::Failed),
_ => Err(serde::de::Error::unknown_variant(value, FIELDS)),
}
}
}
deserializer.deserialize_any(GeneratedVisitor)
}
}
impl serde::Serialize for BackupMetaRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.remarks.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.BackupMetaRequest", len)?;
if let Some(v) = self.remarks.as_ref() {
struct_ser.serialize_field("remarks", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for BackupMetaRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"remarks",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Remarks,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"remarks" => Ok(GeneratedField::Remarks),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = BackupMetaRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.BackupMetaRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<BackupMetaRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut remarks__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Remarks => {
if remarks__.is_some() {
return Err(serde::de::Error::duplicate_field("remarks"));
}
remarks__ = map_.next_value()?;
}
}
}
Ok(BackupMetaRequest {
remarks: remarks__,
})
}
}
deserializer.deserialize_struct("backup_service.BackupMetaRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for BackupMetaResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.job_id != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.BackupMetaResponse", len)?;
if self.job_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("jobId", ToString::to_string(&self.job_id).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for BackupMetaResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"job_id",
"jobId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
JobId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"jobId" | "job_id" => Ok(GeneratedField::JobId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = BackupMetaResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.BackupMetaResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<BackupMetaResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut job_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::JobId => {
if job_id__.is_some() {
return Err(serde::de::Error::duplicate_field("jobId"));
}
job_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(BackupMetaResponse {
job_id: job_id__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.BackupMetaResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for DeleteMetaSnapshotRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if !self.snapshot_ids.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.DeleteMetaSnapshotRequest", len)?;
if !self.snapshot_ids.is_empty() {
struct_ser.serialize_field("snapshotIds", &self.snapshot_ids.iter().map(ToString::to_string).collect::<Vec<_>>())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for DeleteMetaSnapshotRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"snapshot_ids",
"snapshotIds",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SnapshotIds,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"snapshotIds" | "snapshot_ids" => Ok(GeneratedField::SnapshotIds),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = DeleteMetaSnapshotRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.DeleteMetaSnapshotRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<DeleteMetaSnapshotRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut snapshot_ids__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SnapshotIds => {
if snapshot_ids__.is_some() {
return Err(serde::de::Error::duplicate_field("snapshotIds"));
}
snapshot_ids__ =
Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
.into_iter().map(|x| x.0).collect())
;
}
}
}
Ok(DeleteMetaSnapshotRequest {
snapshot_ids: snapshot_ids__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.DeleteMetaSnapshotRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for DeleteMetaSnapshotResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("backup_service.DeleteMetaSnapshotResponse", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for DeleteMetaSnapshotResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = DeleteMetaSnapshotResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.DeleteMetaSnapshotResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<DeleteMetaSnapshotResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(DeleteMetaSnapshotResponse {
})
}
}
deserializer.deserialize_struct("backup_service.DeleteMetaSnapshotResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for GetBackupJobStatusRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.job_id != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.GetBackupJobStatusRequest", len)?;
if self.job_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("jobId", ToString::to_string(&self.job_id).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for GetBackupJobStatusRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"job_id",
"jobId",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
JobId,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"jobId" | "job_id" => Ok(GeneratedField::JobId),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GetBackupJobStatusRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.GetBackupJobStatusRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetBackupJobStatusRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut job_id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::JobId => {
if job_id__.is_some() {
return Err(serde::de::Error::duplicate_field("jobId"));
}
job_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(GetBackupJobStatusRequest {
job_id: job_id__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.GetBackupJobStatusRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for GetBackupJobStatusResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.job_id != 0 {
len += 1;
}
if self.job_status != 0 {
len += 1;
}
if !self.message.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.GetBackupJobStatusResponse", len)?;
if self.job_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("jobId", ToString::to_string(&self.job_id).as_str())?;
}
if self.job_status != 0 {
let v = BackupJobStatus::try_from(self.job_status)
.map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.job_status)))?;
struct_ser.serialize_field("jobStatus", &v)?;
}
if !self.message.is_empty() {
struct_ser.serialize_field("message", &self.message)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for GetBackupJobStatusResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"job_id",
"jobId",
"job_status",
"jobStatus",
"message",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
JobId,
JobStatus,
Message,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"jobId" | "job_id" => Ok(GeneratedField::JobId),
"jobStatus" | "job_status" => Ok(GeneratedField::JobStatus),
"message" => Ok(GeneratedField::Message),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GetBackupJobStatusResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.GetBackupJobStatusResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetBackupJobStatusResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut job_id__ = None;
let mut job_status__ = None;
let mut message__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::JobId => {
if job_id__.is_some() {
return Err(serde::de::Error::duplicate_field("jobId"));
}
job_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::JobStatus => {
if job_status__.is_some() {
return Err(serde::de::Error::duplicate_field("jobStatus"));
}
job_status__ = Some(map_.next_value::<BackupJobStatus>()? as i32);
}
GeneratedField::Message => {
if message__.is_some() {
return Err(serde::de::Error::duplicate_field("message"));
}
message__ = Some(map_.next_value()?);
}
}
}
Ok(GetBackupJobStatusResponse {
job_id: job_id__.unwrap_or_default(),
job_status: job_status__.unwrap_or_default(),
message: message__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.GetBackupJobStatusResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for GetMetaSnapshotManifestRequest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let len = 0;
let struct_ser = serializer.serialize_struct("backup_service.GetMetaSnapshotManifestRequest", len)?;
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for GetMetaSnapshotManifestRequest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
Err(serde::de::Error::unknown_field(value, FIELDS))
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GetMetaSnapshotManifestRequest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.GetMetaSnapshotManifestRequest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetMetaSnapshotManifestRequest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
while map_.next_key::<GeneratedField>()?.is_some() {
let _ = map_.next_value::<serde::de::IgnoredAny>()?;
}
Ok(GetMetaSnapshotManifestRequest {
})
}
}
deserializer.deserialize_struct("backup_service.GetMetaSnapshotManifestRequest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for GetMetaSnapshotManifestResponse {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.manifest.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.GetMetaSnapshotManifestResponse", len)?;
if let Some(v) = self.manifest.as_ref() {
struct_ser.serialize_field("manifest", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for GetMetaSnapshotManifestResponse {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"manifest",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Manifest,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"manifest" => Ok(GeneratedField::Manifest),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GetMetaSnapshotManifestResponse;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.GetMetaSnapshotManifestResponse")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<GetMetaSnapshotManifestResponse, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut manifest__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Manifest => {
if manifest__.is_some() {
return Err(serde::de::Error::duplicate_field("manifest"));
}
manifest__ = map_.next_value()?;
}
}
}
Ok(GetMetaSnapshotManifestResponse {
manifest: manifest__,
})
}
}
deserializer.deserialize_struct("backup_service.GetMetaSnapshotManifestResponse", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for MetaBackupManifestId {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.MetaBackupManifestId", len)?;
if self.id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for MetaBackupManifestId {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = MetaBackupManifestId;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.MetaBackupManifestId")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaBackupManifestId, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
}
}
Ok(MetaBackupManifestId {
id: id__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.MetaBackupManifestId", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for MetaSnapshotManifest {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.manifest_id != 0 {
len += 1;
}
if !self.snapshot_metadata.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.MetaSnapshotManifest", len)?;
if self.manifest_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("manifestId", ToString::to_string(&self.manifest_id).as_str())?;
}
if !self.snapshot_metadata.is_empty() {
struct_ser.serialize_field("snapshotMetadata", &self.snapshot_metadata)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for MetaSnapshotManifest {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"manifest_id",
"manifestId",
"snapshot_metadata",
"snapshotMetadata",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
ManifestId,
SnapshotMetadata,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"manifestId" | "manifest_id" => Ok(GeneratedField::ManifestId),
"snapshotMetadata" | "snapshot_metadata" => Ok(GeneratedField::SnapshotMetadata),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = MetaSnapshotManifest;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.MetaSnapshotManifest")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaSnapshotManifest, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut manifest_id__ = None;
let mut snapshot_metadata__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::ManifestId => {
if manifest_id__.is_some() {
return Err(serde::de::Error::duplicate_field("manifestId"));
}
manifest_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::SnapshotMetadata => {
if snapshot_metadata__.is_some() {
return Err(serde::de::Error::duplicate_field("snapshotMetadata"));
}
snapshot_metadata__ = Some(map_.next_value()?);
}
}
}
Ok(MetaSnapshotManifest {
manifest_id: manifest_id__.unwrap_or_default(),
snapshot_metadata: snapshot_metadata__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.MetaSnapshotManifest", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for MetaSnapshotMetadata {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
use serde::ser::SerializeStruct;
let mut len = 0;
if self.id != 0 {
len += 1;
}
if self.hummock_version_id != 0 {
len += 1;
}
if self.format_version.is_some() {
len += 1;
}
if self.remarks.is_some() {
len += 1;
}
if self.rw_version.is_some() {
len += 1;
}
if !self.state_table_info.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("backup_service.MetaSnapshotMetadata", len)?;
if self.id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("id", ToString::to_string(&self.id).as_str())?;
}
if self.hummock_version_id != 0 {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("hummockVersionId", ToString::to_string(&self.hummock_version_id).as_str())?;
}
if let Some(v) = self.format_version.as_ref() {
struct_ser.serialize_field("formatVersion", v)?;
}
if let Some(v) = self.remarks.as_ref() {
struct_ser.serialize_field("remarks", v)?;
}
if let Some(v) = self.rw_version.as_ref() {
struct_ser.serialize_field("rwVersion", v)?;
}
if !self.state_table_info.is_empty() {
struct_ser.serialize_field("stateTableInfo", &self.state_table_info)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for MetaSnapshotMetadata {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"id",
"hummock_version_id",
"hummockVersionId",
"format_version",
"formatVersion",
"remarks",
"rw_version",
"rwVersion",
"state_table_info",
"stateTableInfo",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Id,
HummockVersionId,
FormatVersion,
Remarks,
RwVersion,
StateTableInfo,
}
impl<'de> serde::Deserialize<'de> for GeneratedField {
fn deserialize<D>(deserializer: D) -> std::result::Result<GeneratedField, D::Error>
where
D: serde::Deserializer<'de>,
{
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = GeneratedField;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(formatter, "expected one of: {:?}", &FIELDS)
}
#[allow(unused_variables)]
fn visit_str<E>(self, value: &str) -> std::result::Result<GeneratedField, E>
where
E: serde::de::Error,
{
match value {
"id" => Ok(GeneratedField::Id),
"hummockVersionId" | "hummock_version_id" => Ok(GeneratedField::HummockVersionId),
"formatVersion" | "format_version" => Ok(GeneratedField::FormatVersion),
"remarks" => Ok(GeneratedField::Remarks),
"rwVersion" | "rw_version" => Ok(GeneratedField::RwVersion),
"stateTableInfo" | "state_table_info" => Ok(GeneratedField::StateTableInfo),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = MetaSnapshotMetadata;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct backup_service.MetaSnapshotMetadata")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<MetaSnapshotMetadata, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut id__ = None;
let mut hummock_version_id__ = None;
let mut format_version__ = None;
let mut remarks__ = None;
let mut rw_version__ = None;
let mut state_table_info__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Id => {
if id__.is_some() {
return Err(serde::de::Error::duplicate_field("id"));
}
id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::HummockVersionId => {
if hummock_version_id__.is_some() {
return Err(serde::de::Error::duplicate_field("hummockVersionId"));
}
hummock_version_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::FormatVersion => {
if format_version__.is_some() {
return Err(serde::de::Error::duplicate_field("formatVersion"));
}
format_version__ =
map_.next_value::<::std::option::Option<::pbjson::private::NumberDeserialize<_>>>()?.map(|x| x.0)
;
}
GeneratedField::Remarks => {
if remarks__.is_some() {
return Err(serde::de::Error::duplicate_field("remarks"));
}
remarks__ = map_.next_value()?;
}
GeneratedField::RwVersion => {
if rw_version__.is_some() {
return Err(serde::de::Error::duplicate_field("rwVersion"));
}
rw_version__ = map_.next_value()?;
}
GeneratedField::StateTableInfo => {
if state_table_info__.is_some() {
return Err(serde::de::Error::duplicate_field("stateTableInfo"));
}
state_table_info__ = Some(
map_.next_value::<std::collections::HashMap<::pbjson::private::NumberDeserialize<u32>, _>>()?
.into_iter().map(|(k,v)| (k.0, v)).collect()
);
}
}
}
Ok(MetaSnapshotMetadata {
id: id__.unwrap_or_default(),
hummock_version_id: hummock_version_id__.unwrap_or_default(),
format_version: format_version__,
remarks: remarks__,
rw_version: rw_version__,
state_table_info: state_table_info__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("backup_service.MetaSnapshotMetadata", FIELDS, GeneratedVisitor)
}
}