#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
#[repr(i32)]
pub enum CodecErrorReason {
CODEC_ERROR_REASON_UNSPECIFIED = 0i32,
CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC = 100i32,
CODEC_ERROR_REASON_BASE_INVALID_ENCODING = 101i32,
CODEC_ERROR_REASON_BASE_INVALID_LENGTH = 102i32,
CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE = 103i32,
CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE = 104i32,
CODEC_ERROR_REASON_BASE_INVALID_BASE64 = 110i32,
CODEC_ERROR_REASON_BASE_INVALID_BASE64URL = 111i32,
CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL = 112i32,
CODEC_ERROR_REASON_BASE_INVALID_HEX = 120i32,
CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX = 121i32,
CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY = 200i32,
CODEC_ERROR_REASON_PEM_LABEL_MISMATCH = 201i32,
CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL = 202i32,
CODEC_ERROR_REASON_PEM_INVALID_BODY = 203i32,
CODEC_ERROR_REASON_PEM_DER_TOO_LARGE = 204i32,
CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX = 300i32,
CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX = 301i32,
CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC = 302i32,
CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY = 303i32,
CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR = 400i32,
CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR = 401i32,
CODEC_ERROR_REASON_CANONICAL_INVALID_JSON = 402i32,
CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON = 403i32,
CODEC_ERROR_REASON_CANONICAL_INTERNAL = 404i32,
}
impl CodecErrorReason {
#[allow(non_upper_case_globals)]
pub const Unspecified: Self = Self::CODEC_ERROR_REASON_UNSPECIFIED;
#[allow(non_upper_case_globals)]
pub const BaseUnsupportedCodec: Self = Self::CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC;
#[allow(non_upper_case_globals)]
pub const BaseInvalidEncoding: Self = Self::CODEC_ERROR_REASON_BASE_INVALID_ENCODING;
#[allow(non_upper_case_globals)]
pub const BaseInvalidLength: Self = Self::CODEC_ERROR_REASON_BASE_INVALID_LENGTH;
#[allow(non_upper_case_globals)]
pub const BaseInputTooLarge: Self = Self::CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE;
#[allow(non_upper_case_globals)]
pub const BaseOutputTooLarge: Self = Self::CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE;
#[allow(non_upper_case_globals)]
pub const BaseInvalidBase64: Self = Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64;
#[allow(non_upper_case_globals)]
pub const BaseInvalidBase64url: Self = Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64URL;
#[allow(non_upper_case_globals)]
pub const BaseNonCanonicalBase64url: Self = Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL;
#[allow(non_upper_case_globals)]
pub const BaseInvalidHex: Self = Self::CODEC_ERROR_REASON_BASE_INVALID_HEX;
#[allow(non_upper_case_globals)]
pub const BaseNonCanonicalHex: Self = Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX;
#[allow(non_upper_case_globals)]
pub const PemInvalidBoundary: Self = Self::CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY;
#[allow(non_upper_case_globals)]
pub const PemLabelMismatch: Self = Self::CODEC_ERROR_REASON_PEM_LABEL_MISMATCH;
#[allow(non_upper_case_globals)]
pub const PemUnsupportedLabel: Self = Self::CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL;
#[allow(non_upper_case_globals)]
pub const PemInvalidBody: Self = Self::CODEC_ERROR_REASON_PEM_INVALID_BODY;
#[allow(non_upper_case_globals)]
pub const PemDerTooLarge: Self = Self::CODEC_ERROR_REASON_PEM_DER_TOO_LARGE;
#[allow(non_upper_case_globals)]
pub const MultiformatInvalidMultibasePrefix: Self = Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX;
#[allow(non_upper_case_globals)]
pub const MultiformatInvalidMulticodecPrefix: Self = Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX;
#[allow(non_upper_case_globals)]
pub const MultiformatUnknownMulticodec: Self = Self::CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC;
#[allow(non_upper_case_globals)]
pub const MultiformatInvalidMultikey: Self = Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY;
#[allow(non_upper_case_globals)]
pub const CanonicalInvalidCbor: Self = Self::CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR;
#[allow(non_upper_case_globals)]
pub const CanonicalNonCanonicalCbor: Self = Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR;
#[allow(non_upper_case_globals)]
pub const CanonicalInvalidJson: Self = Self::CODEC_ERROR_REASON_CANONICAL_INVALID_JSON;
#[allow(non_upper_case_globals)]
pub const CanonicalNonCanonicalJson: Self = Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON;
#[allow(non_upper_case_globals)]
pub const CanonicalInternal: Self = Self::CODEC_ERROR_REASON_CANONICAL_INTERNAL;
}
impl ::core::default::Default for CodecErrorReason {
fn default() -> Self {
Self::CODEC_ERROR_REASON_UNSPECIFIED
}
}
impl ::serde::Serialize for CodecErrorReason {
fn serialize<S: ::serde::Serializer>(
&self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
s.serialize_str(::buffa::Enumeration::proto_name(self))
}
}
impl<'de> ::serde::Deserialize<'de> for CodecErrorReason {
fn deserialize<D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
struct _V;
impl ::serde::de::Visitor<'_> for _V {
type Value = CodecErrorReason;
fn expecting(
&self,
f: &mut ::core::fmt::Formatter<'_>,
) -> ::core::fmt::Result {
f.write_str(
concat!(
"a string, integer, or null for ", stringify!(CodecErrorReason)
),
)
}
fn visit_str<E: ::serde::de::Error>(
self,
v: &str,
) -> ::core::result::Result<CodecErrorReason, E> {
<CodecErrorReason as ::buffa::Enumeration>::from_proto_name(v)
.ok_or_else(|| { ::serde::de::Error::unknown_variant(v, &[]) })
}
fn visit_i64<E: ::serde::de::Error>(
self,
v: i64,
) -> ::core::result::Result<CodecErrorReason, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<CodecErrorReason as ::buffa::Enumeration>::from_i32(v32)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_u64<E: ::serde::de::Error>(
self,
v: u64,
) -> ::core::result::Result<CodecErrorReason, E> {
let v32 = i32::try_from(v)
.map_err(|_| {
::serde::de::Error::custom(
::buffa::alloc::format!("enum value {v} out of i32 range"),
)
})?;
<CodecErrorReason as ::buffa::Enumeration>::from_i32(v32)
.ok_or_else(|| {
::serde::de::Error::custom(
::buffa::alloc::format!("unknown enum value {v32}"),
)
})
}
fn visit_unit<E: ::serde::de::Error>(
self,
) -> ::core::result::Result<CodecErrorReason, E> {
::core::result::Result::Ok(::core::default::Default::default())
}
}
d.deserialize_any(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for CodecErrorReason {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
impl ::buffa::Enumeration for CodecErrorReason {
fn from_i32(value: i32) -> ::core::option::Option<Self> {
match value {
0i32 => ::core::option::Option::Some(Self::CODEC_ERROR_REASON_UNSPECIFIED),
100i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC,
)
}
101i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_ENCODING,
)
}
102i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_LENGTH,
)
}
103i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE,
)
}
104i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE,
)
}
110i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64,
)
}
111i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64URL,
)
}
112i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL,
)
}
120i32 => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_BASE_INVALID_HEX)
}
121i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX,
)
}
200i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY,
)
}
201i32 => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_PEM_LABEL_MISMATCH)
}
202i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL,
)
}
203i32 => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_PEM_INVALID_BODY)
}
204i32 => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_PEM_DER_TOO_LARGE)
}
300i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX,
)
}
301i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX,
)
}
302i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC,
)
}
303i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY,
)
}
400i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR,
)
}
401i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR,
)
}
402i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_JSON,
)
}
403i32 => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON,
)
}
404i32 => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_CANONICAL_INTERNAL)
}
_ => ::core::option::Option::None,
}
}
fn to_i32(&self) -> i32 {
*self as i32
}
fn proto_name(&self) -> &'static str {
match self {
Self::CODEC_ERROR_REASON_UNSPECIFIED => "CODEC_ERROR_REASON_UNSPECIFIED",
Self::CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC => {
"CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC"
}
Self::CODEC_ERROR_REASON_BASE_INVALID_ENCODING => {
"CODEC_ERROR_REASON_BASE_INVALID_ENCODING"
}
Self::CODEC_ERROR_REASON_BASE_INVALID_LENGTH => {
"CODEC_ERROR_REASON_BASE_INVALID_LENGTH"
}
Self::CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE => {
"CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE"
}
Self::CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE => {
"CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE"
}
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64 => {
"CODEC_ERROR_REASON_BASE_INVALID_BASE64"
}
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64URL => {
"CODEC_ERROR_REASON_BASE_INVALID_BASE64URL"
}
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL => {
"CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL"
}
Self::CODEC_ERROR_REASON_BASE_INVALID_HEX => {
"CODEC_ERROR_REASON_BASE_INVALID_HEX"
}
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX => {
"CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX"
}
Self::CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY => {
"CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY"
}
Self::CODEC_ERROR_REASON_PEM_LABEL_MISMATCH => {
"CODEC_ERROR_REASON_PEM_LABEL_MISMATCH"
}
Self::CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL => {
"CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL"
}
Self::CODEC_ERROR_REASON_PEM_INVALID_BODY => {
"CODEC_ERROR_REASON_PEM_INVALID_BODY"
}
Self::CODEC_ERROR_REASON_PEM_DER_TOO_LARGE => {
"CODEC_ERROR_REASON_PEM_DER_TOO_LARGE"
}
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX => {
"CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX"
}
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX => {
"CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX"
}
Self::CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC => {
"CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC"
}
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY => {
"CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY"
}
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR => {
"CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR"
}
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR => {
"CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR"
}
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_JSON => {
"CODEC_ERROR_REASON_CANONICAL_INVALID_JSON"
}
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON => {
"CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON"
}
Self::CODEC_ERROR_REASON_CANONICAL_INTERNAL => {
"CODEC_ERROR_REASON_CANONICAL_INTERNAL"
}
}
}
fn from_proto_name(name: &str) -> ::core::option::Option<Self> {
match name {
"CODEC_ERROR_REASON_UNSPECIFIED" => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_UNSPECIFIED)
}
"CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC,
)
}
"CODEC_ERROR_REASON_BASE_INVALID_ENCODING" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_ENCODING,
)
}
"CODEC_ERROR_REASON_BASE_INVALID_LENGTH" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_LENGTH,
)
}
"CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE,
)
}
"CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE,
)
}
"CODEC_ERROR_REASON_BASE_INVALID_BASE64" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64,
)
}
"CODEC_ERROR_REASON_BASE_INVALID_BASE64URL" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64URL,
)
}
"CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL,
)
}
"CODEC_ERROR_REASON_BASE_INVALID_HEX" => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_BASE_INVALID_HEX)
}
"CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX,
)
}
"CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY,
)
}
"CODEC_ERROR_REASON_PEM_LABEL_MISMATCH" => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_PEM_LABEL_MISMATCH)
}
"CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL,
)
}
"CODEC_ERROR_REASON_PEM_INVALID_BODY" => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_PEM_INVALID_BODY)
}
"CODEC_ERROR_REASON_PEM_DER_TOO_LARGE" => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_PEM_DER_TOO_LARGE)
}
"CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX,
)
}
"CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX,
)
}
"CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC,
)
}
"CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY,
)
}
"CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR,
)
}
"CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR,
)
}
"CODEC_ERROR_REASON_CANONICAL_INVALID_JSON" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_JSON,
)
}
"CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON" => {
::core::option::Option::Some(
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON,
)
}
"CODEC_ERROR_REASON_CANONICAL_INTERNAL" => {
::core::option::Option::Some(Self::CODEC_ERROR_REASON_CANONICAL_INTERNAL)
}
_ => ::core::option::Option::None,
}
}
fn values() -> &'static [Self] {
&[
Self::CODEC_ERROR_REASON_UNSPECIFIED,
Self::CODEC_ERROR_REASON_BASE_UNSUPPORTED_CODEC,
Self::CODEC_ERROR_REASON_BASE_INVALID_ENCODING,
Self::CODEC_ERROR_REASON_BASE_INVALID_LENGTH,
Self::CODEC_ERROR_REASON_BASE_INPUT_TOO_LARGE,
Self::CODEC_ERROR_REASON_BASE_OUTPUT_TOO_LARGE,
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64,
Self::CODEC_ERROR_REASON_BASE_INVALID_BASE64URL,
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_BASE64URL,
Self::CODEC_ERROR_REASON_BASE_INVALID_HEX,
Self::CODEC_ERROR_REASON_BASE_NON_CANONICAL_HEX,
Self::CODEC_ERROR_REASON_PEM_INVALID_BOUNDARY,
Self::CODEC_ERROR_REASON_PEM_LABEL_MISMATCH,
Self::CODEC_ERROR_REASON_PEM_UNSUPPORTED_LABEL,
Self::CODEC_ERROR_REASON_PEM_INVALID_BODY,
Self::CODEC_ERROR_REASON_PEM_DER_TOO_LARGE,
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIBASE_PREFIX,
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTICODEC_PREFIX,
Self::CODEC_ERROR_REASON_MULTIFORMAT_UNKNOWN_MULTICODEC,
Self::CODEC_ERROR_REASON_MULTIFORMAT_INVALID_MULTIKEY,
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_CBOR,
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_CBOR,
Self::CODEC_ERROR_REASON_CANONICAL_INVALID_JSON,
Self::CODEC_ERROR_REASON_CANONICAL_NON_CANONICAL_JSON,
Self::CODEC_ERROR_REASON_CANONICAL_INTERNAL,
]
}
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize)]
#[serde(default)]
pub struct CodecError {
#[serde(flatten)]
pub error: ::core::option::Option<__buffa::oneof::codec_error::Error>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodecError {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodecError").field("error", &self.error).finish()
}
}
impl CodecError {
pub const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecError";
}
::buffa::impl_default_instance!(CodecError);
impl ::buffa::MessageName for CodecError {
const PACKAGE: &'static str = "reallyme.codec.v1";
const NAME: &'static str = "CodecError";
const FULL_NAME: &'static str = "reallyme.codec.v1.CodecError";
const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecError";
}
impl ::buffa::Message for CodecError {
#[allow(clippy::let_and_return)]
fn compute_size(&self, __cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
if let ::core::option::Option::Some(ref v) = self.error {
match v {
__buffa::oneof::codec_error::Error::BaseEncoding(x) => {
let __slot = __cache.reserve();
let inner = x.compute_size(__cache);
__cache.set(__slot, inner);
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
__buffa::oneof::codec_error::Error::Pem(x) => {
let __slot = __cache.reserve();
let inner = x.compute_size(__cache);
__cache.set(__slot, inner);
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
__buffa::oneof::codec_error::Error::Multiformat(x) => {
let __slot = __cache.reserve();
let inner = x.compute_size(__cache);
__cache.set(__slot, inner);
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
__buffa::oneof::codec_error::Error::Canonicalization(x) => {
let __slot = __cache.reserve();
let inner = x.compute_size(__cache);
__cache.set(__slot, inner);
size
+= 1u32 + ::buffa::encoding::varint_len(inner as u64) as u32
+ inner;
}
}
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
__cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if let ::core::option::Option::Some(ref v) = self.error {
match v {
__buffa::oneof::codec_error::Error::BaseEncoding(x) => {
::buffa::types::put_len_delimited_header(
1u32,
__cache.consume_next(),
buf,
);
x.write_to(__cache, buf);
}
__buffa::oneof::codec_error::Error::Pem(x) => {
::buffa::types::put_len_delimited_header(
2u32,
__cache.consume_next(),
buf,
);
x.write_to(__cache, buf);
}
__buffa::oneof::codec_error::Error::Multiformat(x) => {
::buffa::types::put_len_delimited_header(
3u32,
__cache.consume_next(),
buf,
);
x.write_to(__cache, buf);
}
__buffa::oneof::codec_error::Error::Canonicalization(x) => {
::buffa::types::put_len_delimited_header(
4u32,
__cache.consume_next(),
buf,
);
x.write_to(__cache, buf);
}
}
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
if let ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::BaseEncoding(ref mut existing),
) = self.error
{
::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
self.error = ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::BaseEncoding(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
2u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
if let ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::Pem(ref mut existing),
) = self.error
{
::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
self.error = ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::Pem(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
3u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
if let ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::Multiformat(ref mut existing),
) = self.error
{
::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
self.error = ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::Multiformat(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
4u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::LengthDelimited,
)?;
if let ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::Canonicalization(
ref mut existing,
),
) = self.error
{
::buffa::Message::merge_length_delimited(&mut **existing, buf, ctx)?;
} else {
let mut val = ::core::default::Default::default();
::buffa::Message::merge_length_delimited(&mut val, buf, ctx)?;
self.error = ::core::option::Option::Some(
__buffa::oneof::codec_error::Error::Canonicalization(
::buffa::alloc::boxed::Box::new(val),
),
);
}
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.error = ::core::option::Option::None;
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodecError {
const PROTO_FQN: &'static str = "reallyme.codec.v1.CodecError";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl<'de> serde::Deserialize<'de> for CodecError {
fn deserialize<D: serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
struct _V;
impl<'de> serde::de::Visitor<'de> for _V {
type Value = CodecError;
fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str("struct CodecError")
}
#[allow(clippy::field_reassign_with_default)]
fn visit_map<A: serde::de::MapAccess<'de>>(
self,
mut map: A,
) -> ::core::result::Result<CodecError, A::Error> {
let mut __oneof_error: ::core::option::Option<
__buffa::oneof::codec_error::Error,
> = None;
while let Some(key) = map.next_key::<::buffa::alloc::string::String>()? {
match key.as_str() {
"baseEncoding" | "base_encoding" => {
let v: ::core::option::Option<CodecBaseEncodingError> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
CodecBaseEncodingError,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_error.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'error'",
),
);
}
__oneof_error = Some(
__buffa::oneof::codec_error::Error::BaseEncoding(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
"pem" => {
let v: ::core::option::Option<CodecPemError> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
CodecPemError,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_error.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'error'",
),
);
}
__oneof_error = Some(
__buffa::oneof::codec_error::Error::Pem(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
"multiformat" => {
let v: ::core::option::Option<CodecMultiformatError> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
CodecMultiformatError,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_error.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'error'",
),
);
}
__oneof_error = Some(
__buffa::oneof::codec_error::Error::Multiformat(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
"canonicalization" => {
let v: ::core::option::Option<CodecCanonicalizationError> = map
.next_value_seed(
::buffa::json_helpers::NullableDeserializeSeed(
::buffa::json_helpers::DefaultDeserializeSeed::<
CodecCanonicalizationError,
>::new(),
),
)?;
if let Some(v) = v {
if __oneof_error.is_some() {
return Err(
serde::de::Error::custom(
"multiple oneof fields set for 'error'",
),
);
}
__oneof_error = Some(
__buffa::oneof::codec_error::Error::Canonicalization(
::buffa::alloc::boxed::Box::new(v),
),
);
}
}
_ => {
map.next_value::<serde::de::IgnoredAny>()?;
}
}
}
let mut __r = <CodecError as ::core::default::Default>::default();
__r.error = __oneof_error;
Ok(__r)
}
}
d.deserialize_map(_V)
}
}
impl ::buffa::json_helpers::ProtoElemJson for CodecError {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CODEC_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/reallyme.codec.v1.CodecError",
to_json: ::buffa::type_registry::any_to_json::<CodecError>,
from_json: ::buffa::type_registry::any_from_json::<CodecError>,
is_wkt: false,
};
pub mod codec_error {
#[allow(unused_imports)]
use super::*;
#[doc(inline)]
pub use super::__buffa::oneof::codec_error::Error;
#[doc(inline)]
pub use super::__buffa::view::oneof::codec_error::Error as ErrorView;
}
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CodecBaseEncodingError {
#[serde(
rename = "reason",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub reason: ::buffa::EnumValue<CodecErrorReason>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodecBaseEncodingError {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodecBaseEncodingError").field("reason", &self.reason).finish()
}
}
impl CodecBaseEncodingError {
pub const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecBaseEncodingError";
}
::buffa::impl_default_instance!(CodecBaseEncodingError);
impl ::buffa::MessageName for CodecBaseEncodingError {
const PACKAGE: &'static str = "reallyme.codec.v1";
const NAME: &'static str = "CodecBaseEncodingError";
const FULL_NAME: &'static str = "reallyme.codec.v1.CodecBaseEncodingError";
const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecBaseEncodingError";
}
impl ::buffa::Message for CodecBaseEncodingError {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
{
let val = self.reason.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.reason.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.reason = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.reason = ::buffa::EnumValue::from(0);
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodecBaseEncodingError {
const PROTO_FQN: &'static str = "reallyme.codec.v1.CodecBaseEncodingError";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CodecBaseEncodingError {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CODEC_BASE_ENCODING_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/reallyme.codec.v1.CodecBaseEncodingError",
to_json: ::buffa::type_registry::any_to_json::<CodecBaseEncodingError>,
from_json: ::buffa::type_registry::any_from_json::<CodecBaseEncodingError>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CodecPemError {
#[serde(
rename = "reason",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub reason: ::buffa::EnumValue<CodecErrorReason>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodecPemError {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodecPemError").field("reason", &self.reason).finish()
}
}
impl CodecPemError {
pub const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecPemError";
}
::buffa::impl_default_instance!(CodecPemError);
impl ::buffa::MessageName for CodecPemError {
const PACKAGE: &'static str = "reallyme.codec.v1";
const NAME: &'static str = "CodecPemError";
const FULL_NAME: &'static str = "reallyme.codec.v1.CodecPemError";
const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecPemError";
}
impl ::buffa::Message for CodecPemError {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
{
let val = self.reason.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.reason.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.reason = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.reason = ::buffa::EnumValue::from(0);
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodecPemError {
const PROTO_FQN: &'static str = "reallyme.codec.v1.CodecPemError";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CodecPemError {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CODEC_PEM_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/reallyme.codec.v1.CodecPemError",
to_json: ::buffa::type_registry::any_to_json::<CodecPemError>,
from_json: ::buffa::type_registry::any_from_json::<CodecPemError>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CodecMultiformatError {
#[serde(
rename = "reason",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub reason: ::buffa::EnumValue<CodecErrorReason>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodecMultiformatError {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodecMultiformatError").field("reason", &self.reason).finish()
}
}
impl CodecMultiformatError {
pub const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecMultiformatError";
}
::buffa::impl_default_instance!(CodecMultiformatError);
impl ::buffa::MessageName for CodecMultiformatError {
const PACKAGE: &'static str = "reallyme.codec.v1";
const NAME: &'static str = "CodecMultiformatError";
const FULL_NAME: &'static str = "reallyme.codec.v1.CodecMultiformatError";
const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecMultiformatError";
}
impl ::buffa::Message for CodecMultiformatError {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
{
let val = self.reason.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.reason.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.reason = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.reason = ::buffa::EnumValue::from(0);
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodecMultiformatError {
const PROTO_FQN: &'static str = "reallyme.codec.v1.CodecMultiformatError";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CodecMultiformatError {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CODEC_MULTIFORMAT_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/reallyme.codec.v1.CodecMultiformatError",
to_json: ::buffa::type_registry::any_to_json::<CodecMultiformatError>,
from_json: ::buffa::type_registry::any_from_json::<CodecMultiformatError>,
is_wkt: false,
};
#[derive(Clone, PartialEq, Default)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(default)]
pub struct CodecCanonicalizationError {
#[serde(
rename = "reason",
with = "::buffa::json_helpers::proto_enum",
skip_serializing_if = "::buffa::json_helpers::skip_if::is_default_enum_value"
)]
pub reason: ::buffa::EnumValue<CodecErrorReason>,
#[serde(skip)]
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for CodecCanonicalizationError {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("CodecCanonicalizationError")
.field("reason", &self.reason)
.finish()
}
}
impl CodecCanonicalizationError {
pub const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecCanonicalizationError";
}
::buffa::impl_default_instance!(CodecCanonicalizationError);
impl ::buffa::MessageName for CodecCanonicalizationError {
const PACKAGE: &'static str = "reallyme.codec.v1";
const NAME: &'static str = "CodecCanonicalizationError";
const FULL_NAME: &'static str = "reallyme.codec.v1.CodecCanonicalizationError";
const TYPE_URL: &'static str = "type.googleapis.com/reallyme.codec.v1.CodecCanonicalizationError";
}
impl ::buffa::Message for CodecCanonicalizationError {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u32;
{
let val = self.reason.to_i32();
if val != 0 {
size += 1u32 + ::buffa::types::int32_encoded_len(val) as u32;
}
}
size += self.__buffa_unknown_fields.encoded_len() as u32;
size
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::bytes::BufMut,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
{
let val = self.reason.to_i32();
if val != 0 {
::buffa::types::put_int32_field(1u32, val, buf);
}
}
self.__buffa_unknown_fields.write_to(buf);
}
fn merge_field(
&mut self,
tag: ::buffa::encoding::Tag,
buf: &mut impl ::buffa::bytes::Buf,
ctx: ::buffa::DecodeContext<'_>,
) -> ::core::result::Result<(), ::buffa::DecodeError> {
#[allow(unused_imports)]
use ::buffa::bytes::Buf as _;
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match tag.field_number() {
1u32 => {
::buffa::encoding::check_wire_type(
tag,
::buffa::encoding::WireType::Varint,
)?;
self.reason = ::buffa::EnumValue::from(
::buffa::types::decode_int32(buf)?,
);
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.reason = ::buffa::EnumValue::from(0);
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for CodecCanonicalizationError {
const PROTO_FQN: &'static str = "reallyme.codec.v1.CodecCanonicalizationError";
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
&mut self.__buffa_unknown_fields
}
}
impl ::buffa::json_helpers::ProtoElemJson for CodecCanonicalizationError {
fn serialize_proto_json<S: ::serde::Serializer>(
v: &Self,
s: S,
) -> ::core::result::Result<S::Ok, S::Error> {
::serde::Serialize::serialize(v, s)
}
fn deserialize_proto_json<'de, D: ::serde::Deserializer<'de>>(
d: D,
) -> ::core::result::Result<Self, D::Error> {
<Self as ::serde::Deserialize>::deserialize(d)
}
}
#[doc(hidden)]
pub const __CODEC_CANONICALIZATION_ERROR_JSON_ANY: ::buffa::type_registry::JsonAnyEntry = ::buffa::type_registry::JsonAnyEntry {
type_url: "type.googleapis.com/reallyme.codec.v1.CodecCanonicalizationError",
to_json: ::buffa::type_registry::any_to_json::<CodecCanonicalizationError>,
from_json: ::buffa::type_registry::any_from_json::<CodecCanonicalizationError>,
is_wkt: false,
};