#![allow(
clippy::too_many_arguments,
clippy::large_enum_variant,
clippy::result_large_err,
clippy::doc_markdown,
clippy::doc_lazy_continuation,
)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub struct AccountPhotoGetArg {
pub dbx_account_id: String,
pub size: String,
pub circle_crop: bool,
pub expect_account_photo: bool,
}
impl AccountPhotoGetArg {
pub fn new(
dbx_account_id: String,
size: String,
circle_crop: bool,
expect_account_photo: bool,
) -> Self {
AccountPhotoGetArg {
dbx_account_id,
size,
circle_crop,
expect_account_photo,
}
}
}
const ACCOUNT_PHOTO_GET_ARG_FIELDS: &[&str] = &["dbx_account_id",
"size",
"circle_crop",
"expect_account_photo"];
impl AccountPhotoGetArg {
pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
map: V,
) -> Result<AccountPhotoGetArg, V::Error> {
Self::internal_deserialize_opt(map, false).map(Option::unwrap)
}
pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
mut map: V,
optional: bool,
) -> Result<Option<AccountPhotoGetArg>, V::Error> {
let mut field_dbx_account_id = None;
let mut field_size = None;
let mut field_circle_crop = None;
let mut field_expect_account_photo = None;
let mut nothing = true;
while let Some(key) = map.next_key::<&str>()? {
nothing = false;
match key {
"dbx_account_id" => {
if field_dbx_account_id.is_some() {
return Err(::serde::de::Error::duplicate_field("dbx_account_id"));
}
field_dbx_account_id = Some(map.next_value()?);
}
"size" => {
if field_size.is_some() {
return Err(::serde::de::Error::duplicate_field("size"));
}
field_size = Some(map.next_value()?);
}
"circle_crop" => {
if field_circle_crop.is_some() {
return Err(::serde::de::Error::duplicate_field("circle_crop"));
}
field_circle_crop = Some(map.next_value()?);
}
"expect_account_photo" => {
if field_expect_account_photo.is_some() {
return Err(::serde::de::Error::duplicate_field("expect_account_photo"));
}
field_expect_account_photo = Some(map.next_value()?);
}
_ => {
map.next_value::<::serde_json::Value>()?;
}
}
}
if optional && nothing {
return Ok(None);
}
let result = AccountPhotoGetArg {
dbx_account_id: field_dbx_account_id.ok_or_else(|| ::serde::de::Error::missing_field("dbx_account_id"))?,
size: field_size.ok_or_else(|| ::serde::de::Error::missing_field("size"))?,
circle_crop: field_circle_crop.ok_or_else(|| ::serde::de::Error::missing_field("circle_crop"))?,
expect_account_photo: field_expect_account_photo.ok_or_else(|| ::serde::de::Error::missing_field("expect_account_photo"))?,
};
Ok(Some(result))
}
pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
&self,
s: &mut S::SerializeStruct,
) -> Result<(), S::Error> {
use serde::ser::SerializeStruct;
s.serialize_field("dbx_account_id", &self.dbx_account_id)?;
s.serialize_field("size", &self.size)?;
s.serialize_field("circle_crop", &self.circle_crop)?;
s.serialize_field("expect_account_photo", &self.expect_account_photo)?;
Ok(())
}
}
impl<'de> ::serde::de::Deserialize<'de> for AccountPhotoGetArg {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{MapAccess, Visitor};
struct StructVisitor;
impl<'de> Visitor<'de> for StructVisitor {
type Value = AccountPhotoGetArg;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a AccountPhotoGetArg struct")
}
fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
AccountPhotoGetArg::internal_deserialize(map)
}
}
deserializer.deserialize_struct("AccountPhotoGetArg", ACCOUNT_PHOTO_GET_ARG_FIELDS, StructVisitor)
}
}
impl ::serde::ser::Serialize for AccountPhotoGetArg {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
let mut s = serializer.serialize_struct("AccountPhotoGetArg", 4)?;
self.internal_serialize::<S>(&mut s)?;
s.end()
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub enum AccountPhotoGetError {
ThumbnailError(ThumbnailError),
AccountPhotoMissing,
ExpectedAccountPhotoMissing,
Other,
}
impl<'de> ::serde::de::Deserialize<'de> for AccountPhotoGetError {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{self, MapAccess, Visitor};
struct EnumVisitor;
impl<'de> Visitor<'de> for EnumVisitor {
type Value = AccountPhotoGetError;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a AccountPhotoGetError structure")
}
fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
let tag: &str = match map.next_key()? {
Some(".tag") => map.next_value()?,
_ => return Err(de::Error::missing_field(".tag"))
};
let value = match tag {
"thumbnail_error" => {
match map.next_key()? {
Some("thumbnail_error") => AccountPhotoGetError::ThumbnailError(map.next_value()?),
None => return Err(de::Error::missing_field("thumbnail_error")),
_ => return Err(de::Error::unknown_field(tag, VARIANTS))
}
}
"account_photo_missing" => AccountPhotoGetError::AccountPhotoMissing,
"expected_account_photo_missing" => AccountPhotoGetError::ExpectedAccountPhotoMissing,
_ => AccountPhotoGetError::Other,
};
crate::eat_json_fields(&mut map)?;
Ok(value)
}
}
const VARIANTS: &[&str] = &["thumbnail_error",
"account_photo_missing",
"expected_account_photo_missing",
"other"];
deserializer.deserialize_struct("AccountPhotoGetError", VARIANTS, EnumVisitor)
}
}
impl ::serde::ser::Serialize for AccountPhotoGetError {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
match self {
AccountPhotoGetError::ThumbnailError(x) => {
let mut s = serializer.serialize_struct("AccountPhotoGetError", 2)?;
s.serialize_field(".tag", "thumbnail_error")?;
s.serialize_field("thumbnail_error", x)?;
s.end()
}
AccountPhotoGetError::AccountPhotoMissing => {
let mut s = serializer.serialize_struct("AccountPhotoGetError", 1)?;
s.serialize_field(".tag", "account_photo_missing")?;
s.end()
}
AccountPhotoGetError::ExpectedAccountPhotoMissing => {
let mut s = serializer.serialize_struct("AccountPhotoGetError", 1)?;
s.serialize_field(".tag", "expected_account_photo_missing")?;
s.end()
}
AccountPhotoGetError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
}
}
}
impl ::std::error::Error for AccountPhotoGetError {
fn source(&self) -> Option<&(dyn ::std::error::Error + 'static)> {
match self {
AccountPhotoGetError::ThumbnailError(inner) => Some(inner),
_ => None,
}
}
}
impl ::std::fmt::Display for AccountPhotoGetError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
AccountPhotoGetError::ThumbnailError(inner) => write!(f, "Indicates infrastructural failure: {}", inner),
AccountPhotoGetError::AccountPhotoMissing => f.write_str("Account photo is missing (but we did not expect it to exist)."),
AccountPhotoGetError::ExpectedAccountPhotoMissing => f.write_str("Account photo was expected to exist, but it's missing."),
_ => write!(f, "{:?}", *self),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub struct AccountPhotoGetResult {
pub content_type: String,
}
impl AccountPhotoGetResult {
pub fn new(content_type: String) -> Self {
AccountPhotoGetResult {
content_type,
}
}
}
const ACCOUNT_PHOTO_GET_RESULT_FIELDS: &[&str] = &["content_type"];
impl AccountPhotoGetResult {
pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
map: V,
) -> Result<AccountPhotoGetResult, V::Error> {
Self::internal_deserialize_opt(map, false).map(Option::unwrap)
}
pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
mut map: V,
optional: bool,
) -> Result<Option<AccountPhotoGetResult>, V::Error> {
let mut field_content_type = None;
let mut nothing = true;
while let Some(key) = map.next_key::<&str>()? {
nothing = false;
match key {
"content_type" => {
if field_content_type.is_some() {
return Err(::serde::de::Error::duplicate_field("content_type"));
}
field_content_type = Some(map.next_value()?);
}
_ => {
map.next_value::<::serde_json::Value>()?;
}
}
}
if optional && nothing {
return Ok(None);
}
let result = AccountPhotoGetResult {
content_type: field_content_type.ok_or_else(|| ::serde::de::Error::missing_field("content_type"))?,
};
Ok(Some(result))
}
pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
&self,
s: &mut S::SerializeStruct,
) -> Result<(), S::Error> {
use serde::ser::SerializeStruct;
s.serialize_field("content_type", &self.content_type)?;
Ok(())
}
}
impl<'de> ::serde::de::Deserialize<'de> for AccountPhotoGetResult {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{MapAccess, Visitor};
struct StructVisitor;
impl<'de> Visitor<'de> for StructVisitor {
type Value = AccountPhotoGetResult;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a AccountPhotoGetResult struct")
}
fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
AccountPhotoGetResult::internal_deserialize(map)
}
}
deserializer.deserialize_struct("AccountPhotoGetResult", ACCOUNT_PHOTO_GET_RESULT_FIELDS, StructVisitor)
}
}
impl ::serde::ser::Serialize for AccountPhotoGetResult {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
let mut s = serializer.serialize_struct("AccountPhotoGetResult", 1)?;
self.internal_serialize::<S>(&mut s)?;
s.end()
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub enum PhotoSourceArg {
Base64Data(String),
Other,
}
impl<'de> ::serde::de::Deserialize<'de> for PhotoSourceArg {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{self, MapAccess, Visitor};
struct EnumVisitor;
impl<'de> Visitor<'de> for EnumVisitor {
type Value = PhotoSourceArg;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a PhotoSourceArg structure")
}
fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
let tag: &str = match map.next_key()? {
Some(".tag") => map.next_value()?,
_ => return Err(de::Error::missing_field(".tag"))
};
let value = match tag {
"base64_data" => {
match map.next_key()? {
Some("base64_data") => PhotoSourceArg::Base64Data(map.next_value()?),
None => return Err(de::Error::missing_field("base64_data")),
_ => return Err(de::Error::unknown_field(tag, VARIANTS))
}
}
_ => PhotoSourceArg::Other,
};
crate::eat_json_fields(&mut map)?;
Ok(value)
}
}
const VARIANTS: &[&str] = &["base64_data",
"other"];
deserializer.deserialize_struct("PhotoSourceArg", VARIANTS, EnumVisitor)
}
}
impl ::serde::ser::Serialize for PhotoSourceArg {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
match self {
PhotoSourceArg::Base64Data(x) => {
let mut s = serializer.serialize_struct("PhotoSourceArg", 2)?;
s.serialize_field(".tag", "base64_data")?;
s.serialize_field("base64_data", x)?;
s.end()
}
PhotoSourceArg::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub struct SetProfilePhotoArg {
pub photo: PhotoSourceArg,
}
impl SetProfilePhotoArg {
pub fn new(photo: PhotoSourceArg) -> Self {
SetProfilePhotoArg {
photo,
}
}
}
const SET_PROFILE_PHOTO_ARG_FIELDS: &[&str] = &["photo"];
impl SetProfilePhotoArg {
pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
map: V,
) -> Result<SetProfilePhotoArg, V::Error> {
Self::internal_deserialize_opt(map, false).map(Option::unwrap)
}
pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
mut map: V,
optional: bool,
) -> Result<Option<SetProfilePhotoArg>, V::Error> {
let mut field_photo = None;
let mut nothing = true;
while let Some(key) = map.next_key::<&str>()? {
nothing = false;
match key {
"photo" => {
if field_photo.is_some() {
return Err(::serde::de::Error::duplicate_field("photo"));
}
field_photo = Some(map.next_value()?);
}
_ => {
map.next_value::<::serde_json::Value>()?;
}
}
}
if optional && nothing {
return Ok(None);
}
let result = SetProfilePhotoArg {
photo: field_photo.ok_or_else(|| ::serde::de::Error::missing_field("photo"))?,
};
Ok(Some(result))
}
pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
&self,
s: &mut S::SerializeStruct,
) -> Result<(), S::Error> {
use serde::ser::SerializeStruct;
s.serialize_field("photo", &self.photo)?;
Ok(())
}
}
impl<'de> ::serde::de::Deserialize<'de> for SetProfilePhotoArg {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{MapAccess, Visitor};
struct StructVisitor;
impl<'de> Visitor<'de> for StructVisitor {
type Value = SetProfilePhotoArg;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a SetProfilePhotoArg struct")
}
fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
SetProfilePhotoArg::internal_deserialize(map)
}
}
deserializer.deserialize_struct("SetProfilePhotoArg", SET_PROFILE_PHOTO_ARG_FIELDS, StructVisitor)
}
}
impl ::serde::ser::Serialize for SetProfilePhotoArg {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
let mut s = serializer.serialize_struct("SetProfilePhotoArg", 1)?;
self.internal_serialize::<S>(&mut s)?;
s.end()
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub enum SetProfilePhotoError {
FileTypeError,
FileSizeError,
DimensionError,
ThumbnailError,
TransientError,
Other,
}
impl<'de> ::serde::de::Deserialize<'de> for SetProfilePhotoError {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{self, MapAccess, Visitor};
struct EnumVisitor;
impl<'de> Visitor<'de> for EnumVisitor {
type Value = SetProfilePhotoError;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a SetProfilePhotoError structure")
}
fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
let tag: &str = match map.next_key()? {
Some(".tag") => map.next_value()?,
_ => return Err(de::Error::missing_field(".tag"))
};
let value = match tag {
"file_type_error" => SetProfilePhotoError::FileTypeError,
"file_size_error" => SetProfilePhotoError::FileSizeError,
"dimension_error" => SetProfilePhotoError::DimensionError,
"thumbnail_error" => SetProfilePhotoError::ThumbnailError,
"transient_error" => SetProfilePhotoError::TransientError,
_ => SetProfilePhotoError::Other,
};
crate::eat_json_fields(&mut map)?;
Ok(value)
}
}
const VARIANTS: &[&str] = &["file_type_error",
"file_size_error",
"dimension_error",
"thumbnail_error",
"transient_error",
"other"];
deserializer.deserialize_struct("SetProfilePhotoError", VARIANTS, EnumVisitor)
}
}
impl ::serde::ser::Serialize for SetProfilePhotoError {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
match self {
SetProfilePhotoError::FileTypeError => {
let mut s = serializer.serialize_struct("SetProfilePhotoError", 1)?;
s.serialize_field(".tag", "file_type_error")?;
s.end()
}
SetProfilePhotoError::FileSizeError => {
let mut s = serializer.serialize_struct("SetProfilePhotoError", 1)?;
s.serialize_field(".tag", "file_size_error")?;
s.end()
}
SetProfilePhotoError::DimensionError => {
let mut s = serializer.serialize_struct("SetProfilePhotoError", 1)?;
s.serialize_field(".tag", "dimension_error")?;
s.end()
}
SetProfilePhotoError::ThumbnailError => {
let mut s = serializer.serialize_struct("SetProfilePhotoError", 1)?;
s.serialize_field(".tag", "thumbnail_error")?;
s.end()
}
SetProfilePhotoError::TransientError => {
let mut s = serializer.serialize_struct("SetProfilePhotoError", 1)?;
s.serialize_field(".tag", "transient_error")?;
s.end()
}
SetProfilePhotoError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
}
}
}
impl ::std::error::Error for SetProfilePhotoError {
}
impl ::std::fmt::Display for SetProfilePhotoError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
SetProfilePhotoError::FileTypeError => f.write_str("File cannot be set as profile photo."),
SetProfilePhotoError::FileSizeError => f.write_str("File cannot exceed 10 MB."),
SetProfilePhotoError::DimensionError => f.write_str("Image must be larger than 128 x 128."),
SetProfilePhotoError::ThumbnailError => f.write_str("Image could not be thumbnailed."),
SetProfilePhotoError::TransientError => f.write_str("Temporary infrastructure failure, please retry."),
_ => write!(f, "{:?}", *self),
}
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub struct SetProfilePhotoResult {
pub profile_photo_url: String,
}
impl SetProfilePhotoResult {
pub fn new(profile_photo_url: String) -> Self {
SetProfilePhotoResult {
profile_photo_url,
}
}
}
const SET_PROFILE_PHOTO_RESULT_FIELDS: &[&str] = &["profile_photo_url"];
impl SetProfilePhotoResult {
pub(crate) fn internal_deserialize<'de, V: ::serde::de::MapAccess<'de>>(
map: V,
) -> Result<SetProfilePhotoResult, V::Error> {
Self::internal_deserialize_opt(map, false).map(Option::unwrap)
}
pub(crate) fn internal_deserialize_opt<'de, V: ::serde::de::MapAccess<'de>>(
mut map: V,
optional: bool,
) -> Result<Option<SetProfilePhotoResult>, V::Error> {
let mut field_profile_photo_url = None;
let mut nothing = true;
while let Some(key) = map.next_key::<&str>()? {
nothing = false;
match key {
"profile_photo_url" => {
if field_profile_photo_url.is_some() {
return Err(::serde::de::Error::duplicate_field("profile_photo_url"));
}
field_profile_photo_url = Some(map.next_value()?);
}
_ => {
map.next_value::<::serde_json::Value>()?;
}
}
}
if optional && nothing {
return Ok(None);
}
let result = SetProfilePhotoResult {
profile_photo_url: field_profile_photo_url.ok_or_else(|| ::serde::de::Error::missing_field("profile_photo_url"))?,
};
Ok(Some(result))
}
pub(crate) fn internal_serialize<S: ::serde::ser::Serializer>(
&self,
s: &mut S::SerializeStruct,
) -> Result<(), S::Error> {
use serde::ser::SerializeStruct;
s.serialize_field("profile_photo_url", &self.profile_photo_url)?;
Ok(())
}
}
impl<'de> ::serde::de::Deserialize<'de> for SetProfilePhotoResult {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{MapAccess, Visitor};
struct StructVisitor;
impl<'de> Visitor<'de> for StructVisitor {
type Value = SetProfilePhotoResult;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a SetProfilePhotoResult struct")
}
fn visit_map<V: MapAccess<'de>>(self, map: V) -> Result<Self::Value, V::Error> {
SetProfilePhotoResult::internal_deserialize(map)
}
}
deserializer.deserialize_struct("SetProfilePhotoResult", SET_PROFILE_PHOTO_RESULT_FIELDS, StructVisitor)
}
}
impl ::serde::ser::Serialize for SetProfilePhotoResult {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
let mut s = serializer.serialize_struct("SetProfilePhotoResult", 1)?;
self.internal_serialize::<S>(&mut s)?;
s.end()
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive] pub enum ThumbnailError {
PermanentFailure,
TemporaryFailure,
Other,
}
impl<'de> ::serde::de::Deserialize<'de> for ThumbnailError {
fn deserialize<D: ::serde::de::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
use serde::de::{self, MapAccess, Visitor};
struct EnumVisitor;
impl<'de> Visitor<'de> for EnumVisitor {
type Value = ThumbnailError;
fn expecting(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
f.write_str("a ThumbnailError structure")
}
fn visit_map<V: MapAccess<'de>>(self, mut map: V) -> Result<Self::Value, V::Error> {
let tag: &str = match map.next_key()? {
Some(".tag") => map.next_value()?,
_ => return Err(de::Error::missing_field(".tag"))
};
let value = match tag {
"permanent_failure" => ThumbnailError::PermanentFailure,
"temporary_failure" => ThumbnailError::TemporaryFailure,
_ => ThumbnailError::Other,
};
crate::eat_json_fields(&mut map)?;
Ok(value)
}
}
const VARIANTS: &[&str] = &["permanent_failure",
"temporary_failure",
"other"];
deserializer.deserialize_struct("ThumbnailError", VARIANTS, EnumVisitor)
}
}
impl ::serde::ser::Serialize for ThumbnailError {
fn serialize<S: ::serde::ser::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
use serde::ser::SerializeStruct;
match self {
ThumbnailError::PermanentFailure => {
let mut s = serializer.serialize_struct("ThumbnailError", 1)?;
s.serialize_field(".tag", "permanent_failure")?;
s.end()
}
ThumbnailError::TemporaryFailure => {
let mut s = serializer.serialize_struct("ThumbnailError", 1)?;
s.serialize_field(".tag", "temporary_failure")?;
s.end()
}
ThumbnailError::Other => Err(::serde::ser::Error::custom("cannot serialize 'Other' variant"))
}
}
}
impl ::std::error::Error for ThumbnailError {
}
impl ::std::fmt::Display for ThumbnailError {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
match self {
ThumbnailError::PermanentFailure => f.write_str("Indicates permanent infrastructural failure."),
ThumbnailError::TemporaryFailure => f.write_str("Indicates temporary infrastructural failure."),
_ => write!(f, "{:?}", *self),
}
}
}