use crate::source::*;
impl serde::Serialize for ConnectorSplit {
#[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.split_type.is_empty() {
len += 1;
}
if !self.encoded_split.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("source.ConnectorSplit", len)?;
if !self.split_type.is_empty() {
struct_ser.serialize_field("splitType", &self.split_type)?;
}
if !self.encoded_split.is_empty() {
#[allow(clippy::needless_borrow)]
#[allow(clippy::needless_borrows_for_generic_args)]
struct_ser.serialize_field("encodedSplit", pbjson::private::base64::encode(&self.encoded_split).as_str())?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ConnectorSplit {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"split_type",
"splitType",
"encoded_split",
"encodedSplit",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
SplitType,
EncodedSplit,
}
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 {
"splitType" | "split_type" => Ok(GeneratedField::SplitType),
"encodedSplit" | "encoded_split" => Ok(GeneratedField::EncodedSplit),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ConnectorSplit;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct source.ConnectorSplit")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ConnectorSplit, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut split_type__ = None;
let mut encoded_split__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::SplitType => {
if split_type__.is_some() {
return Err(serde::de::Error::duplicate_field("splitType"));
}
split_type__ = Some(map_.next_value()?);
}
GeneratedField::EncodedSplit => {
if encoded_split__.is_some() {
return Err(serde::de::Error::duplicate_field("encodedSplit"));
}
encoded_split__ =
Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0)
;
}
}
}
Ok(ConnectorSplit {
split_type: split_type__.unwrap_or_default(),
encoded_split: encoded_split__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("source.ConnectorSplit", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for ConnectorSplits {
#[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.splits.is_empty() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("source.ConnectorSplits", len)?;
if !self.splits.is_empty() {
struct_ser.serialize_field("splits", &self.splits)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for ConnectorSplits {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"splits",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
Splits,
}
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 {
"splits" => Ok(GeneratedField::Splits),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = ConnectorSplits;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct source.ConnectorSplits")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<ConnectorSplits, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut splits__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::Splits => {
if splits__.is_some() {
return Err(serde::de::Error::duplicate_field("splits"));
}
splits__ = Some(map_.next_value()?);
}
}
}
Ok(ConnectorSplits {
splits: splits__.unwrap_or_default(),
})
}
}
deserializer.deserialize_struct("source.ConnectorSplits", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for SourceActorInfo {
#[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.actor_id != 0 {
len += 1;
}
if self.splits.is_some() {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("source.SourceActorInfo", len)?;
if self.actor_id != 0 {
struct_ser.serialize_field("actorId", &self.actor_id)?;
}
if let Some(v) = self.splits.as_ref() {
struct_ser.serialize_field("splits", v)?;
}
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for SourceActorInfo {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
const FIELDS: &[&str] = &[
"actor_id",
"actorId",
"splits",
];
#[allow(clippy::enum_variant_names)]
enum GeneratedField {
ActorId,
Splits,
}
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 {
"actorId" | "actor_id" => Ok(GeneratedField::ActorId),
"splits" => Ok(GeneratedField::Splits),
_ => Err(serde::de::Error::unknown_field(value, FIELDS)),
}
}
}
deserializer.deserialize_identifier(GeneratedVisitor)
}
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = SourceActorInfo;
fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str("struct source.SourceActorInfo")
}
fn visit_map<V>(self, mut map_: V) -> std::result::Result<SourceActorInfo, V::Error>
where
V: serde::de::MapAccess<'de>,
{
let mut actor_id__ = None;
let mut splits__ = None;
while let Some(k) = map_.next_key()? {
match k {
GeneratedField::ActorId => {
if actor_id__.is_some() {
return Err(serde::de::Error::duplicate_field("actorId"));
}
actor_id__ =
Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0)
;
}
GeneratedField::Splits => {
if splits__.is_some() {
return Err(serde::de::Error::duplicate_field("splits"));
}
splits__ = map_.next_value()?;
}
}
}
Ok(SourceActorInfo {
actor_id: actor_id__.unwrap_or_default(),
splits: splits__,
})
}
}
deserializer.deserialize_struct("source.SourceActorInfo", FIELDS, GeneratedVisitor)
}
}