Created
April 8, 2020 17:25
-
-
Save Igosuki/27e18369fec5a05d4019ac5d321e1779 to your computer and use it in GitHub Desktop.
rust-protobuf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is generated by rust-protobuf 3.0.0-pre. Do not edit | |
// .proto file is parsed by protobuf-codegen-pure=3.0.0-pre | |
// @generated | |
// https://github.com/rust-lang/rust-clippy/issues/702 | |
#![allow(unknown_lints)] | |
#![allow(clippy::all)] | |
#![cfg_attr(rustfmt, rustfmt_skip)] | |
#![allow(box_pointers)] | |
#![allow(dead_code)] | |
#![allow(missing_docs)] | |
#![allow(non_camel_case_types)] | |
#![allow(non_snake_case)] | |
#![allow(non_upper_case_globals)] | |
#![allow(trivial_casts)] | |
#![allow(unused_imports)] | |
#![allow(unused_results)] | |
//! Generated file from `extensions.proto` | |
/// Generated files are compatible only with the same version | |
/// of protobuf runtime. | |
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_0_0_PRE; | |
#[derive(PartialEq,Clone,Default)] | |
#[derive(Serialize, Deserialize)] | |
pub struct TestAExt { | |
// message fields | |
pub test_extension: ::std::option::Option<i32>, | |
// special fields | |
#[serde(skip)] | |
pub unknown_fields: ::protobuf::UnknownFields, | |
#[serde(skip)] | |
pub cached_size: ::protobuf::rt::CachedSize, | |
} | |
impl<'a> ::std::default::Default for &'a TestAExt { | |
fn default() -> &'a TestAExt { | |
<TestAExt as ::protobuf::Message>::default_instance() | |
} | |
} | |
impl TestAExt { | |
pub fn new() -> TestAExt { | |
::std::default::Default::default() | |
} | |
// optional int32 test_extension = 1234; | |
pub fn get_test_extension(&self) -> i32 { | |
self.test_extension.unwrap_or(0) | |
} | |
} | |
impl ::protobuf::Message for TestAExt { | |
fn is_initialized(&self) -> bool { | |
true | |
} | |
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { | |
while !is.eof()? { | |
let (field_number, wire_type) = is.read_tag_unpack()?; | |
match field_number { | |
1234 => { | |
if wire_type != ::protobuf::wire_format::WireTypeVarint { | |
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); | |
} | |
self.test_extension = ::std::option::Option::Some(is.read_int32()?); | |
}, | |
_ => { | |
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; | |
}, | |
}; | |
} | |
::std::result::Result::Ok(()) | |
} | |
// Compute sizes of nested messages | |
#[allow(unused_variables)] | |
fn compute_size(&self) -> u32 { | |
let mut my_size = 0; | |
if let Some(v) = self.test_extension { | |
my_size += ::protobuf::rt::value_size(1234, v, ::protobuf::wire_format::WireTypeVarint); | |
} | |
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); | |
self.cached_size.set(my_size); | |
my_size | |
} | |
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { | |
if let Some(v) = self.test_extension { | |
os.write_int32(1234, v)?; | |
} | |
os.write_unknown_fields(self.get_unknown_fields())?; | |
::std::result::Result::Ok(()) | |
} | |
fn get_cached_size(&self) -> u32 { | |
self.cached_size.get() | |
} | |
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { | |
&self.unknown_fields | |
} | |
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { | |
&mut self.unknown_fields | |
} | |
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { | |
Self::descriptor_static() | |
} | |
fn new() -> TestAExt { | |
TestAExt::new() | |
} | |
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { | |
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::INIT; | |
descriptor.get(|| { | |
let mut fields = ::std::vec::Vec::new(); | |
fields.push(::protobuf::reflect::rt::make_option_get_copy_accessor::<_, ::protobuf::reflect::types::ProtobufTypeInt32, _>( | |
"test_extension", | |
|m: &TestAExt| { &m.test_extension }, | |
|m: &mut TestAExt| { &mut m.test_extension }, | |
TestAExt::get_test_extension, | |
)); | |
::protobuf::reflect::MessageDescriptor::new::<TestAExt>( | |
"TestAExt", | |
fields, | |
file_descriptor_proto() | |
) | |
}) | |
} | |
fn default_instance() -> &'static TestAExt { | |
static instance: ::protobuf::rt::Lazy<TestAExt> = ::protobuf::rt::Lazy::INIT; | |
instance.get(TestAExt::new) | |
} | |
} | |
impl ::protobuf::Clear for TestAExt { | |
fn clear(&mut self) { | |
self.test_extension = ::std::option::Option::None; | |
self.unknown_fields.clear(); | |
} | |
} | |
impl ::std::fmt::Debug for TestAExt { | |
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { | |
::protobuf::text_format::fmt(self, f) | |
} | |
} | |
impl ::protobuf::reflect::ProtobufValue for TestAExt { | |
} | |
/// Extension fields | |
pub mod exts { | |
pub const imp: ::protobuf::ext::ExtFieldOptional<super::super::message::TestA, ::protobuf::reflect::types::ProtobufTypeMessage<super::TestAExt>> = ::protobuf::ext::ExtFieldOptional { field_number: 1001, phantom: ::std::marker::PhantomData }; | |
} | |
static file_descriptor_proto_data: &'static [u8] = b"\ | |
\n\x10extensions.proto\x12\0\"'\n\x08TestAExt\x12\x19\n\x0etest_extensio\ | |
n\x18\xd2\t\x20\x01(\x05B\0:\0:!\n\x03imp\x18\xe9\x07\x20\x01(\x0b2\t.Te\ | |
stAExt\x12\x06.TestAB\0B\0b\x06proto2\ | |
"; | |
static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::INIT; | |
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { | |
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() | |
} | |
/// `FileDescriptorProto` object which was a source for this generated file | |
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { | |
file_descriptor_proto_lazy.get(|| { | |
parse_descriptor_proto() | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is generated by rust-protobuf 3.0.0-pre. Do not edit | |
// .proto file is parsed by protobuf-codegen-pure=3.0.0-pre | |
// @generated | |
// https://github.com/rust-lang/rust-clippy/issues/702 | |
#![allow(unknown_lints)] | |
#![allow(clippy::all)] | |
#![cfg_attr(rustfmt, rustfmt_skip)] | |
#![allow(box_pointers)] | |
#![allow(dead_code)] | |
#![allow(missing_docs)] | |
#![allow(non_camel_case_types)] | |
#![allow(non_snake_case)] | |
#![allow(non_upper_case_globals)] | |
#![allow(trivial_casts)] | |
#![allow(unused_imports)] | |
#![allow(unused_results)] | |
//! Generated file from `message.proto` | |
/// Generated files are compatible only with the same version | |
/// of protobuf runtime. | |
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_0_0_PRE; | |
#[derive(PartialEq,Clone,Default)] | |
#[derive(Serialize, Deserialize)] | |
pub struct TestA { | |
// message fields | |
pub i: ::std::option::Option<i32>, | |
// special fields | |
#[serde(skip)] | |
pub unknown_fields: ::protobuf::UnknownFields, | |
#[serde(skip)] | |
pub cached_size: ::protobuf::rt::CachedSize, | |
} | |
impl<'a> ::std::default::Default for &'a TestA { | |
fn default() -> &'a TestA { | |
<TestA as ::protobuf::Message>::default_instance() | |
} | |
} | |
impl TestA { | |
pub fn new() -> TestA { | |
::std::default::Default::default() | |
} | |
// optional int32 i = 1; | |
pub fn get_i(&self) -> i32 { | |
self.i.unwrap_or(0) | |
} | |
} | |
impl ::protobuf::Message for TestA { | |
fn is_initialized(&self) -> bool { | |
true | |
} | |
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { | |
while !is.eof()? { | |
let (field_number, wire_type) = is.read_tag_unpack()?; | |
match field_number { | |
1 => { | |
if wire_type != ::protobuf::wire_format::WireTypeVarint { | |
return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); | |
} | |
self.i = ::std::option::Option::Some(is.read_int32()?); | |
}, | |
_ => { | |
::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; | |
}, | |
}; | |
} | |
::std::result::Result::Ok(()) | |
} | |
// Compute sizes of nested messages | |
#[allow(unused_variables)] | |
fn compute_size(&self) -> u32 { | |
let mut my_size = 0; | |
if let Some(v) = self.i { | |
my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); | |
} | |
my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); | |
self.cached_size.set(my_size); | |
my_size | |
} | |
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { | |
if let Some(v) = self.i { | |
os.write_int32(1, v)?; | |
} | |
os.write_unknown_fields(self.get_unknown_fields())?; | |
::std::result::Result::Ok(()) | |
} | |
fn get_cached_size(&self) -> u32 { | |
self.cached_size.get() | |
} | |
fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { | |
&self.unknown_fields | |
} | |
fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { | |
&mut self.unknown_fields | |
} | |
fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { | |
Self::descriptor_static() | |
} | |
fn new() -> TestA { | |
TestA::new() | |
} | |
fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { | |
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::INIT; | |
descriptor.get(|| { | |
let mut fields = ::std::vec::Vec::new(); | |
fields.push(::protobuf::reflect::rt::make_option_get_copy_accessor::<_, ::protobuf::reflect::types::ProtobufTypeInt32, _>( | |
"i", | |
|m: &TestA| { &m.i }, | |
|m: &mut TestA| { &mut m.i }, | |
TestA::get_i, | |
)); | |
::protobuf::reflect::MessageDescriptor::new::<TestA>( | |
"TestA", | |
fields, | |
file_descriptor_proto() | |
) | |
}) | |
} | |
fn default_instance() -> &'static TestA { | |
static instance: ::protobuf::rt::Lazy<TestA> = ::protobuf::rt::Lazy::INIT; | |
instance.get(TestA::new) | |
} | |
} | |
impl ::protobuf::Clear for TestA { | |
fn clear(&mut self) { | |
self.i = ::std::option::Option::None; | |
self.unknown_fields.clear(); | |
} | |
} | |
impl ::std::fmt::Debug for TestA { | |
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { | |
::protobuf::text_format::fmt(self, f) | |
} | |
} | |
impl ::protobuf::reflect::ProtobufValue for TestA { | |
} | |
static file_descriptor_proto_data: &'static [u8] = b"\ | |
\n\rmessage.proto\x12\0\"\x16\n\x05TestA\x12\x0b\n\x01i\x18\x01\x20\x01(\ | |
\x05B\0:\0B\0b\x06proto2\ | |
"; | |
static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::INIT; | |
fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { | |
::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() | |
} | |
/// `FileDescriptorProto` object which was a source for this generated file | |
pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { | |
file_descriptor_proto_lazy.get(|| { | |
parse_descriptor_proto() | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment