#[derive(Clone, PartialEq, Default)]
#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
pub struct SourceContext {
pub file_name: ::buffa::alloc::string::String,
#[doc(hidden)]
pub __buffa_unknown_fields: ::buffa::UnknownFields,
}
impl ::core::fmt::Debug for SourceContext {
fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
f.debug_struct("SourceContext").field("file_name", &self.file_name).finish()
}
}
impl SourceContext {
pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceContext";
}
::buffa::impl_default_instance!(SourceContext);
#[cfg(feature = "reflect")]
const _: () = {
impl ::buffa_descriptor::reflect::ReflectMessage for SourceContext {
fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
__buffa::reflect::descriptor_pool()
.message(Self::__buffa_reflect_message_index())
}
fn pool(
&self,
) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
__buffa::reflect::descriptor_pool()
}
fn unknown_fields(&self) -> &::buffa::UnknownFields {
&self.__buffa_unknown_fields
}
fn get(
&self,
field: &::buffa_descriptor::FieldDescriptor,
) -> ::buffa_descriptor::reflect::ValueRef<'_> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
match field.number() {
1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.file_name),
_ => {
::core::debug_assert!(
false,
"field number {} is not a member of this message's reflect get()",
field.number(),
);
::buffa_descriptor::reflect::ValueRef::Bool(false)
}
}
}
fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
match field.number() {
1u32 => !self.file_name.is_empty(),
_ => false,
}
}
fn for_each_set(
&self,
f: &mut dyn ::core::ops::FnMut(
&::buffa_descriptor::FieldDescriptor,
::buffa_descriptor::reflect::ValueRef<'_>,
),
) {
let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
self,
);
for fd in md.fields() {
if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
}
}
}
fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
::buffa_descriptor::reflect::DynamicMessage::from_message(
self,
::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
Self::__buffa_reflect_message_index(),
)
}
}
impl ::buffa_descriptor::reflect::ReflectElement for SourceContext {
#[inline]
fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
::buffa_descriptor::reflect::ValueRef::Message(
::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
)
}
}
impl SourceContext {
#[doc(hidden)]
fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
*IDX
.get_or_init(|| {
__buffa::reflect::descriptor_pool()
.message_index(<Self as ::buffa::MessageName>::FULL_NAME)
.expect(
"generated message is registered in the embedded descriptor pool",
)
})
}
}
impl ::buffa_descriptor::reflect::Reflectable for SourceContext {
#[inline]
fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
}
}
};
impl ::buffa::MessageName for SourceContext {
const PACKAGE: &'static str = "google.protobuf";
const NAME: &'static str = "SourceContext";
const FULL_NAME: &'static str = "google.protobuf.SourceContext";
const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceContext";
}
impl ::buffa::Message for SourceContext {
#[allow(clippy::let_and_return)]
fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
let mut size = 0u64;
if !self.file_name.is_empty() {
size += 1u64 + ::buffa::types::string_encoded_len(&self.file_name) as u64;
}
size += self.__buffa_unknown_fields.encoded_len() as u64;
::buffa::saturate_size(size)
}
fn write_to(
&self,
_cache: &mut ::buffa::SizeCache,
buf: &mut impl ::buffa::EncodeSink,
) {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.file_name.is_empty() {
::buffa::types::put_string_field(1u32, &self.file_name, 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,
)?;
::buffa::types::merge_string(&mut self.file_name, buf)?;
}
_ => {
self.__buffa_unknown_fields
.push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
}
}
::core::result::Result::Ok(())
}
fn clear(&mut self) {
self.file_name.clear();
self.__buffa_unknown_fields.clear();
}
}
impl ::buffa::ExtensionSet for SourceContext {
const PROTO_FQN: &'static str = "google.protobuf.SourceContext";
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::text::TextFormat for SourceContext {
fn encode_text(
&self,
enc: &mut ::buffa::text::TextEncoder<'_>,
) -> ::core::fmt::Result {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
if !self.file_name.is_empty() {
enc.write_field_name("file_name")?;
enc.write_string(&self.file_name)?;
}
enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
::core::result::Result::Ok(())
}
fn merge_text(
&mut self,
dec: &mut ::buffa::text::TextDecoder<'_>,
) -> ::core::result::Result<(), ::buffa::text::ParseError> {
#[allow(unused_imports)]
use ::buffa::Enumeration as _;
while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
match __name {
"file_name" => self.file_name = dec.read_string()?.into_owned(),
_ => dec.skip_value()?,
}
}
::core::result::Result::Ok(())
}
}
#[doc(hidden)]
pub const __SOURCE_CONTEXT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
type_url: "type.googleapis.com/google.protobuf.SourceContext",
text_encode: ::buffa::type_registry::any_encode_text::<SourceContext>,
text_merge: ::buffa::type_registry::any_merge_text::<SourceContext>,
};