buffa_types/generated/
google.protobuf.source_context.rs1#[derive(Clone, PartialEq, Default)]
7#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
8pub struct SourceContext {
9 pub file_name: ::buffa::alloc::string::String,
14 #[doc(hidden)]
15 pub __buffa_unknown_fields: ::buffa::UnknownFields,
16}
17impl ::core::fmt::Debug for SourceContext {
18 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
19 f.debug_struct("SourceContext").field("file_name", &self.file_name).finish()
20 }
21}
22impl SourceContext {
23 pub const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceContext";
28}
29::buffa::impl_default_instance!(SourceContext);
30#[cfg(feature = "reflect")]
31const _: () = {
32 impl ::buffa_descriptor::reflect::ReflectMessage for SourceContext {
33 fn message_descriptor(&self) -> &::buffa_descriptor::MessageDescriptor {
34 __buffa::reflect::descriptor_pool()
35 .message(Self::__buffa_reflect_message_index())
36 }
37 fn pool(
38 &self,
39 ) -> &::buffa::alloc::sync::Arc<::buffa_descriptor::DescriptorPool> {
40 __buffa::reflect::descriptor_pool()
41 }
42 fn unknown_fields(&self) -> &::buffa::UnknownFields {
43 &self.__buffa_unknown_fields
44 }
45 fn get(
46 &self,
47 field: &::buffa_descriptor::FieldDescriptor,
48 ) -> ::buffa_descriptor::reflect::ValueRef<'_> {
49 #[allow(unused_imports)]
50 use ::buffa::Enumeration as _;
51 match field.number() {
52 1u32 => ::buffa_descriptor::reflect::ValueRef::String(&self.file_name),
53 _ => {
54 ::core::debug_assert!(
55 false,
56 "field number {} is not a member of this message's reflect get()",
57 field.number(),
58 );
59 ::buffa_descriptor::reflect::ValueRef::Bool(false)
60 }
61 }
62 }
63 fn has(&self, field: &::buffa_descriptor::FieldDescriptor) -> bool {
64 match field.number() {
65 1u32 => !self.file_name.is_empty(),
66 _ => false,
67 }
68 }
69 fn for_each_set(
70 &self,
71 f: &mut dyn ::core::ops::FnMut(
72 &::buffa_descriptor::FieldDescriptor,
73 ::buffa_descriptor::reflect::ValueRef<'_>,
74 ),
75 ) {
76 let md = ::buffa_descriptor::reflect::ReflectMessage::message_descriptor(
77 self,
78 );
79 for fd in md.fields() {
80 if ::buffa_descriptor::reflect::ReflectMessage::has(self, fd) {
81 f(fd, ::buffa_descriptor::reflect::ReflectMessage::get(self, fd));
82 }
83 }
84 }
85 fn to_dynamic(&self) -> ::buffa_descriptor::reflect::DynamicMessage {
86 ::buffa_descriptor::reflect::DynamicMessage::from_message(
87 self,
88 ::buffa::alloc::sync::Arc::clone(__buffa::reflect::descriptor_pool()),
89 Self::__buffa_reflect_message_index(),
90 )
91 }
92 }
93 impl ::buffa_descriptor::reflect::ReflectElement for SourceContext {
94 #[inline]
95 fn as_value_ref(&self) -> ::buffa_descriptor::reflect::ValueRef<'_> {
96 ::buffa_descriptor::reflect::ValueRef::Message(
97 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self),
98 )
99 }
100 }
101 impl SourceContext {
102 #[doc(hidden)]
105 fn __buffa_reflect_message_index() -> ::buffa_descriptor::MessageIndex {
106 static IDX: ::std::sync::OnceLock<::buffa_descriptor::MessageIndex> = ::std::sync::OnceLock::new();
107 *IDX
108 .get_or_init(|| {
109 __buffa::reflect::descriptor_pool()
110 .message_index(<Self as ::buffa::MessageName>::FULL_NAME)
111 .expect(
112 "generated message is registered in the embedded descriptor pool",
113 )
114 })
115 }
116 }
117 impl ::buffa_descriptor::reflect::Reflectable for SourceContext {
118 #[inline]
122 fn reflect(&self) -> ::buffa_descriptor::reflect::ReflectCow<'_> {
123 ::buffa_descriptor::reflect::ReflectCow::Borrowed(self)
124 }
125 }
126};
127impl ::buffa::MessageName for SourceContext {
128 const PACKAGE: &'static str = "google.protobuf";
129 const NAME: &'static str = "SourceContext";
130 const FULL_NAME: &'static str = "google.protobuf.SourceContext";
131 const TYPE_URL: &'static str = "type.googleapis.com/google.protobuf.SourceContext";
132}
133impl ::buffa::Message for SourceContext {
134 #[allow(clippy::let_and_return)]
142 fn compute_size(&self, _cache: &mut ::buffa::SizeCache) -> u32 {
143 #[allow(unused_imports)]
144 use ::buffa::Enumeration as _;
145 let mut size = 0u64;
146 if !self.file_name.is_empty() {
147 size += 1u64 + ::buffa::types::string_encoded_len(&self.file_name) as u64;
148 }
149 size += self.__buffa_unknown_fields.encoded_len() as u64;
150 ::buffa::saturate_size(size)
151 }
152 fn write_to(
153 &self,
154 _cache: &mut ::buffa::SizeCache,
155 buf: &mut impl ::buffa::EncodeSink,
156 ) {
157 #[allow(unused_imports)]
158 use ::buffa::Enumeration as _;
159 if !self.file_name.is_empty() {
160 ::buffa::types::put_string_field(1u32, &self.file_name, buf);
161 }
162 self.__buffa_unknown_fields.write_to(buf);
163 }
164 fn merge_field(
165 &mut self,
166 tag: ::buffa::encoding::Tag,
167 buf: &mut impl ::buffa::bytes::Buf,
168 ctx: ::buffa::DecodeContext<'_>,
169 ) -> ::core::result::Result<(), ::buffa::DecodeError> {
170 #[allow(unused_imports)]
171 use ::buffa::bytes::Buf as _;
172 #[allow(unused_imports)]
173 use ::buffa::Enumeration as _;
174 match tag.field_number() {
175 1u32 => {
176 ::buffa::encoding::check_wire_type(
177 tag,
178 ::buffa::encoding::WireType::LengthDelimited,
179 )?;
180 ::buffa::types::merge_string(&mut self.file_name, buf)?;
181 }
182 _ => {
183 self.__buffa_unknown_fields
184 .push(::buffa::encoding::decode_unknown_field(tag, buf, ctx)?);
185 }
186 }
187 ::core::result::Result::Ok(())
188 }
189 fn clear(&mut self) {
190 self.file_name.clear();
191 self.__buffa_unknown_fields.clear();
192 }
193}
194impl ::buffa::ExtensionSet for SourceContext {
195 const PROTO_FQN: &'static str = "google.protobuf.SourceContext";
196 fn unknown_fields(&self) -> &::buffa::UnknownFields {
197 &self.__buffa_unknown_fields
198 }
199 fn unknown_fields_mut(&mut self) -> &mut ::buffa::UnknownFields {
200 &mut self.__buffa_unknown_fields
201 }
202}
203impl ::buffa::text::TextFormat for SourceContext {
204 fn encode_text(
205 &self,
206 enc: &mut ::buffa::text::TextEncoder<'_>,
207 ) -> ::core::fmt::Result {
208 #[allow(unused_imports)]
209 use ::buffa::Enumeration as _;
210 if !self.file_name.is_empty() {
211 enc.write_field_name("file_name")?;
212 enc.write_string(&self.file_name)?;
213 }
214 enc.write_unknown_fields(&self.__buffa_unknown_fields)?;
215 ::core::result::Result::Ok(())
216 }
217 fn merge_text(
218 &mut self,
219 dec: &mut ::buffa::text::TextDecoder<'_>,
220 ) -> ::core::result::Result<(), ::buffa::text::ParseError> {
221 #[allow(unused_imports)]
222 use ::buffa::Enumeration as _;
223 while let ::core::option::Option::Some(__name) = dec.read_field_name()? {
224 match __name {
225 "file_name" => self.file_name = dec.read_string()?.into_owned(),
226 _ => dec.skip_value()?,
227 }
228 }
229 ::core::result::Result::Ok(())
230 }
231}
232#[doc(hidden)]
233pub const __SOURCE_CONTEXT_TEXT_ANY: ::buffa::type_registry::TextAnyEntry = ::buffa::type_registry::TextAnyEntry {
234 type_url: "type.googleapis.com/google.protobuf.SourceContext",
235 text_encode: ::buffa::type_registry::any_encode_text::<SourceContext>,
236 text_merge: ::buffa::type_registry::any_merge_text::<SourceContext>,
237};