From 72003b9542035abbbd624ae176da3f9d7841a772 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Fri, 11 May 2018 11:21:54 +0800 Subject: [PATCH 1/9] upgrade protobuf to v1.6 and gen binding file in the build script --- Cargo.toml | 5 +- build.rs | 12 + proto/metrics.rs | 2920 ---------------------------------------------- 3 files changed, 16 insertions(+), 2921 deletions(-) create mode 100644 build.rs delete mode 100644 proto/metrics.rs diff --git a/Cargo.toml b/Cargo.toml index a1fa760a..b45f3f2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ name = "benches" path = "benches/benches.rs" [dependencies] -protobuf = "1.4" +protobuf = "1.6" quick-error = "0.2" clippy = {version = "^0", optional = true} fnv = "1.0" @@ -55,3 +55,6 @@ optional = true [dev-dependencies] getopts = "0.2" hyper = {version = "0.9", default-features = false} + +[build-dependencies] +protoc-rust = "1.6" diff --git a/build.rs b/build.rs new file mode 100644 index 00000000..6d7f4dbe --- /dev/null +++ b/build.rs @@ -0,0 +1,12 @@ +extern crate protoc_rust; + +fn main() { + protoc_rust::run(protoc_rust::Args { + out_dir: "proto", + input: &["proto/metrics.proto"], + includes: &["proto"], + customize: protoc_rust::Customize { + ..Default::default() + }, + }).expect("protoc"); +} diff --git a/proto/metrics.rs b/proto/metrics.rs deleted file mode 100644 index eae76bcb..00000000 --- a/proto/metrics.rs +++ /dev/null @@ -1,2920 +0,0 @@ -// This file is generated. Do not edit -// @generated - -// https://github.com/Manishearth/rust-clippy/issues/702 -#![allow(unknown_lints)] -#![allow(clippy)] - -#![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(unsafe_code)] -#![allow(unused_imports)] -#![allow(unused_results)] - -use protobuf::Message as Message_imported_for_functions; -use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; - -#[derive(PartialEq,Clone,Default)] -pub struct LabelPair { - // message fields - name: ::protobuf::SingularField<::std::string::String>, - value: ::protobuf::SingularField<::std::string::String>, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for LabelPair {} - -impl LabelPair { - pub fn new() -> LabelPair { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static LabelPair { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const LabelPair, - }; - unsafe { - instance.get(LabelPair::new) - } - } - - // optional string name = 1; - - pub fn clear_name(&mut self) { - self.name.clear(); - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name.set_default(); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_name(&self) -> &str { - match self.name.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.name - } - - // optional string value = 2; - - pub fn clear_value(&mut self) { - self.value.clear(); - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: ::std::string::String) { - self.value = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_value(&mut self) -> &mut ::std::string::String { - if self.value.is_none() { - self.value.set_default(); - } - self.value.as_mut().unwrap() - } - - // Take field - pub fn take_value(&mut self) -> ::std::string::String { - self.value.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_value(&self) -> &str { - match self.value.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.value - } -} - -impl ::protobuf::Message for LabelPair { - 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 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?; - }, - 2 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.value)?; - }, - _ => { - ::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(ref v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.value.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - 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(ref v) = self.name.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.value.as_ref() { - os.write_string(2, &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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for LabelPair { - fn new() -> LabelPair { - LabelPair::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - LabelPair::get_name_for_reflect, - LabelPair::mut_name_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "value", - LabelPair::get_value_for_reflect, - LabelPair::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "LabelPair", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for LabelPair { - fn clear(&mut self) { - self.clear_name(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for LabelPair { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for LabelPair { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Gauge { - // message fields - value: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Gauge {} - -impl Gauge { - pub fn new() -> Gauge { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Gauge { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Gauge, - }; - unsafe { - instance.get(Gauge::new) - } - } - - // optional double value = 1; - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: f64) { - self.value = ::std::option::Option::Some(v); - } - - pub fn get_value(&self) -> f64 { - self.value.unwrap_or(0.) - } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } -} - -impl ::protobuf::Message for Gauge { - 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::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.value = ::std::option::Option::Some(tmp); - }, - _ => { - ::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.value { - my_size += 9; - } - 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.value { - os.write_double(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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Gauge { - fn new() -> Gauge { - Gauge::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "value", - Gauge::get_value_for_reflect, - Gauge::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Gauge", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Gauge { - fn clear(&mut self) { - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Gauge { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Gauge { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Counter { - // message fields - value: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Counter {} - -impl Counter { - pub fn new() -> Counter { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Counter { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Counter, - }; - unsafe { - instance.get(Counter::new) - } - } - - // optional double value = 1; - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: f64) { - self.value = ::std::option::Option::Some(v); - } - - pub fn get_value(&self) -> f64 { - self.value.unwrap_or(0.) - } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } -} - -impl ::protobuf::Message for Counter { - 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::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.value = ::std::option::Option::Some(tmp); - }, - _ => { - ::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.value { - my_size += 9; - } - 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.value { - os.write_double(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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Counter { - fn new() -> Counter { - Counter::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "value", - Counter::get_value_for_reflect, - Counter::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Counter", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Counter { - fn clear(&mut self) { - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Counter { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Counter { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Quantile { - // message fields - quantile: ::std::option::Option, - value: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Quantile {} - -impl Quantile { - pub fn new() -> Quantile { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Quantile { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Quantile, - }; - unsafe { - instance.get(Quantile::new) - } - } - - // optional double quantile = 1; - - pub fn clear_quantile(&mut self) { - self.quantile = ::std::option::Option::None; - } - - pub fn has_quantile(&self) -> bool { - self.quantile.is_some() - } - - // Param is passed by value, moved - pub fn set_quantile(&mut self, v: f64) { - self.quantile = ::std::option::Option::Some(v); - } - - pub fn get_quantile(&self) -> f64 { - self.quantile.unwrap_or(0.) - } - - fn get_quantile_for_reflect(&self) -> &::std::option::Option { - &self.quantile - } - - fn mut_quantile_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.quantile - } - - // optional double value = 2; - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: f64) { - self.value = ::std::option::Option::Some(v); - } - - pub fn get_value(&self) -> f64 { - self.value.unwrap_or(0.) - } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } -} - -impl ::protobuf::Message for Quantile { - 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::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.quantile = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.value = ::std::option::Option::Some(tmp); - }, - _ => { - ::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.quantile { - my_size += 9; - } - if let Some(v) = self.value { - my_size += 9; - } - 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.quantile { - os.write_double(1, v)?; - } - if let Some(v) = self.value { - os.write_double(2, 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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Quantile { - fn new() -> Quantile { - Quantile::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "quantile", - Quantile::get_quantile_for_reflect, - Quantile::mut_quantile_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "value", - Quantile::get_value_for_reflect, - Quantile::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Quantile", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Quantile { - fn clear(&mut self) { - self.clear_quantile(); - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Quantile { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Quantile { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Summary { - // message fields - sample_count: ::std::option::Option, - sample_sum: ::std::option::Option, - quantile: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Summary {} - -impl Summary { - pub fn new() -> Summary { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Summary { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Summary, - }; - unsafe { - instance.get(Summary::new) - } - } - - // optional uint64 sample_count = 1; - - pub fn clear_sample_count(&mut self) { - self.sample_count = ::std::option::Option::None; - } - - pub fn has_sample_count(&self) -> bool { - self.sample_count.is_some() - } - - // Param is passed by value, moved - pub fn set_sample_count(&mut self, v: u64) { - self.sample_count = ::std::option::Option::Some(v); - } - - pub fn get_sample_count(&self) -> u64 { - self.sample_count.unwrap_or(0) - } - - fn get_sample_count_for_reflect(&self) -> &::std::option::Option { - &self.sample_count - } - - fn mut_sample_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_count - } - - // optional double sample_sum = 2; - - pub fn clear_sample_sum(&mut self) { - self.sample_sum = ::std::option::Option::None; - } - - pub fn has_sample_sum(&self) -> bool { - self.sample_sum.is_some() - } - - // Param is passed by value, moved - pub fn set_sample_sum(&mut self, v: f64) { - self.sample_sum = ::std::option::Option::Some(v); - } - - pub fn get_sample_sum(&self) -> f64 { - self.sample_sum.unwrap_or(0.) - } - - fn get_sample_sum_for_reflect(&self) -> &::std::option::Option { - &self.sample_sum - } - - fn mut_sample_sum_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_sum - } - - // repeated .io.prometheus.client.Quantile quantile = 3; - - pub fn clear_quantile(&mut self) { - self.quantile.clear(); - } - - // Param is passed by value, moved - pub fn set_quantile(&mut self, v: ::protobuf::RepeatedField) { - self.quantile = v; - } - - // Mutable pointer to the field. - pub fn mut_quantile(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.quantile - } - - // Take field - pub fn take_quantile(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.quantile, ::protobuf::RepeatedField::new()) - } - - pub fn get_quantile(&self) -> &[Quantile] { - &self.quantile - } - - fn get_quantile_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.quantile - } - - fn mut_quantile_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.quantile - } -} - -impl ::protobuf::Message for Summary { - fn is_initialized(&self) -> bool { - for v in &self.quantile { - if !v.is_initialized() { - return false; - } - }; - 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)); - } - let tmp = is.read_uint64()?; - self.sample_count = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.sample_sum = ::std::option::Option::Some(tmp); - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.quantile)?; - }, - _ => { - ::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.sample_count { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.sample_sum { - my_size += 9; - } - for value in &self.quantile { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - 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.sample_count { - os.write_uint64(1, v)?; - } - if let Some(v) = self.sample_sum { - os.write_double(2, v)?; - } - for v in &self.quantile { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - 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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Summary { - fn new() -> Summary { - Summary::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "sample_count", - Summary::get_sample_count_for_reflect, - Summary::mut_sample_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "sample_sum", - Summary::get_sample_sum_for_reflect, - Summary::mut_sample_sum_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "quantile", - Summary::get_quantile_for_reflect, - Summary::mut_quantile_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Summary", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Summary { - fn clear(&mut self) { - self.clear_sample_count(); - self.clear_sample_sum(); - self.clear_quantile(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Summary { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Summary { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Untyped { - // message fields - value: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Untyped {} - -impl Untyped { - pub fn new() -> Untyped { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Untyped { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Untyped, - }; - unsafe { - instance.get(Untyped::new) - } - } - - // optional double value = 1; - - pub fn clear_value(&mut self) { - self.value = ::std::option::Option::None; - } - - pub fn has_value(&self) -> bool { - self.value.is_some() - } - - // Param is passed by value, moved - pub fn set_value(&mut self, v: f64) { - self.value = ::std::option::Option::Some(v); - } - - pub fn get_value(&self) -> f64 { - self.value.unwrap_or(0.) - } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } -} - -impl ::protobuf::Message for Untyped { - 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::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.value = ::std::option::Option::Some(tmp); - }, - _ => { - ::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.value { - my_size += 9; - } - 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.value { - os.write_double(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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Untyped { - fn new() -> Untyped { - Untyped::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "value", - Untyped::get_value_for_reflect, - Untyped::mut_value_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Untyped", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Untyped { - fn clear(&mut self) { - self.clear_value(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Untyped { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Untyped { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Histogram { - // message fields - sample_count: ::std::option::Option, - sample_sum: ::std::option::Option, - bucket: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Histogram {} - -impl Histogram { - pub fn new() -> Histogram { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Histogram { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Histogram, - }; - unsafe { - instance.get(Histogram::new) - } - } - - // optional uint64 sample_count = 1; - - pub fn clear_sample_count(&mut self) { - self.sample_count = ::std::option::Option::None; - } - - pub fn has_sample_count(&self) -> bool { - self.sample_count.is_some() - } - - // Param is passed by value, moved - pub fn set_sample_count(&mut self, v: u64) { - self.sample_count = ::std::option::Option::Some(v); - } - - pub fn get_sample_count(&self) -> u64 { - self.sample_count.unwrap_or(0) - } - - fn get_sample_count_for_reflect(&self) -> &::std::option::Option { - &self.sample_count - } - - fn mut_sample_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_count - } - - // optional double sample_sum = 2; - - pub fn clear_sample_sum(&mut self) { - self.sample_sum = ::std::option::Option::None; - } - - pub fn has_sample_sum(&self) -> bool { - self.sample_sum.is_some() - } - - // Param is passed by value, moved - pub fn set_sample_sum(&mut self, v: f64) { - self.sample_sum = ::std::option::Option::Some(v); - } - - pub fn get_sample_sum(&self) -> f64 { - self.sample_sum.unwrap_or(0.) - } - - fn get_sample_sum_for_reflect(&self) -> &::std::option::Option { - &self.sample_sum - } - - fn mut_sample_sum_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_sum - } - - // repeated .io.prometheus.client.Bucket bucket = 3; - - pub fn clear_bucket(&mut self) { - self.bucket.clear(); - } - - // Param is passed by value, moved - pub fn set_bucket(&mut self, v: ::protobuf::RepeatedField) { - self.bucket = v; - } - - // Mutable pointer to the field. - pub fn mut_bucket(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.bucket - } - - // Take field - pub fn take_bucket(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.bucket, ::protobuf::RepeatedField::new()) - } - - pub fn get_bucket(&self) -> &[Bucket] { - &self.bucket - } - - fn get_bucket_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.bucket - } - - fn mut_bucket_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.bucket - } -} - -impl ::protobuf::Message for Histogram { - fn is_initialized(&self) -> bool { - for v in &self.bucket { - if !v.is_initialized() { - return false; - } - }; - 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)); - } - let tmp = is.read_uint64()?; - self.sample_count = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.sample_sum = ::std::option::Option::Some(tmp); - }, - 3 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.bucket)?; - }, - _ => { - ::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.sample_count { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.sample_sum { - my_size += 9; - } - for value in &self.bucket { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - 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.sample_count { - os.write_uint64(1, v)?; - } - if let Some(v) = self.sample_sum { - os.write_double(2, v)?; - } - for v in &self.bucket { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - 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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Histogram { - fn new() -> Histogram { - Histogram::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "sample_count", - Histogram::get_sample_count_for_reflect, - Histogram::mut_sample_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "sample_sum", - Histogram::get_sample_sum_for_reflect, - Histogram::mut_sample_sum_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "bucket", - Histogram::get_bucket_for_reflect, - Histogram::mut_bucket_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Histogram", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Histogram { - fn clear(&mut self) { - self.clear_sample_count(); - self.clear_sample_sum(); - self.clear_bucket(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Histogram { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Histogram { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Bucket { - // message fields - cumulative_count: ::std::option::Option, - upper_bound: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Bucket {} - -impl Bucket { - pub fn new() -> Bucket { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Bucket { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Bucket, - }; - unsafe { - instance.get(Bucket::new) - } - } - - // optional uint64 cumulative_count = 1; - - pub fn clear_cumulative_count(&mut self) { - self.cumulative_count = ::std::option::Option::None; - } - - pub fn has_cumulative_count(&self) -> bool { - self.cumulative_count.is_some() - } - - // Param is passed by value, moved - pub fn set_cumulative_count(&mut self, v: u64) { - self.cumulative_count = ::std::option::Option::Some(v); - } - - pub fn get_cumulative_count(&self) -> u64 { - self.cumulative_count.unwrap_or(0) - } - - fn get_cumulative_count_for_reflect(&self) -> &::std::option::Option { - &self.cumulative_count - } - - fn mut_cumulative_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cumulative_count - } - - // optional double upper_bound = 2; - - pub fn clear_upper_bound(&mut self) { - self.upper_bound = ::std::option::Option::None; - } - - pub fn has_upper_bound(&self) -> bool { - self.upper_bound.is_some() - } - - // Param is passed by value, moved - pub fn set_upper_bound(&mut self, v: f64) { - self.upper_bound = ::std::option::Option::Some(v); - } - - pub fn get_upper_bound(&self) -> f64 { - self.upper_bound.unwrap_or(0.) - } - - fn get_upper_bound_for_reflect(&self) -> &::std::option::Option { - &self.upper_bound - } - - fn mut_upper_bound_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.upper_bound - } -} - -impl ::protobuf::Message for Bucket { - 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)); - } - let tmp = is.read_uint64()?; - self.cumulative_count = ::std::option::Option::Some(tmp); - }, - 2 => { - if wire_type != ::protobuf::wire_format::WireTypeFixed64 { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_double()?; - self.upper_bound = ::std::option::Option::Some(tmp); - }, - _ => { - ::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.cumulative_count { - my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); - } - if let Some(v) = self.upper_bound { - my_size += 9; - } - 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.cumulative_count { - os.write_uint64(1, v)?; - } - if let Some(v) = self.upper_bound { - os.write_double(2, 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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Bucket { - fn new() -> Bucket { - Bucket::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( - "cumulative_count", - Bucket::get_cumulative_count_for_reflect, - Bucket::mut_cumulative_count_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( - "upper_bound", - Bucket::get_upper_bound_for_reflect, - Bucket::mut_upper_bound_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Bucket", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Bucket { - fn clear(&mut self) { - self.clear_cumulative_count(); - self.clear_upper_bound(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Bucket { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Bucket { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct Metric { - // message fields - label: ::protobuf::RepeatedField, - gauge: ::protobuf::SingularPtrField, - counter: ::protobuf::SingularPtrField, - summary: ::protobuf::SingularPtrField, - untyped: ::protobuf::SingularPtrField, - histogram: ::protobuf::SingularPtrField, - timestamp_ms: ::std::option::Option, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Metric {} - -impl Metric { - pub fn new() -> Metric { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static Metric { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Metric, - }; - unsafe { - instance.get(Metric::new) - } - } - - // repeated .io.prometheus.client.LabelPair label = 1; - - pub fn clear_label(&mut self) { - self.label.clear(); - } - - // Param is passed by value, moved - pub fn set_label(&mut self, v: ::protobuf::RepeatedField) { - self.label = v; - } - - // Mutable pointer to the field. - pub fn mut_label(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.label - } - - // Take field - pub fn take_label(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.label, ::protobuf::RepeatedField::new()) - } - - pub fn get_label(&self) -> &[LabelPair] { - &self.label - } - - fn get_label_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.label - } - - fn mut_label_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.label - } - - // optional .io.prometheus.client.Gauge gauge = 2; - - pub fn clear_gauge(&mut self) { - self.gauge.clear(); - } - - pub fn has_gauge(&self) -> bool { - self.gauge.is_some() - } - - // Param is passed by value, moved - pub fn set_gauge(&mut self, v: Gauge) { - self.gauge = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_gauge(&mut self) -> &mut Gauge { - if self.gauge.is_none() { - self.gauge.set_default(); - } - self.gauge.as_mut().unwrap() - } - - // Take field - pub fn take_gauge(&mut self) -> Gauge { - self.gauge.take().unwrap_or_else(|| Gauge::new()) - } - - pub fn get_gauge(&self) -> &Gauge { - self.gauge.as_ref().unwrap_or_else(|| Gauge::default_instance()) - } - - fn get_gauge_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.gauge - } - - fn mut_gauge_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.gauge - } - - // optional .io.prometheus.client.Counter counter = 3; - - pub fn clear_counter(&mut self) { - self.counter.clear(); - } - - pub fn has_counter(&self) -> bool { - self.counter.is_some() - } - - // Param is passed by value, moved - pub fn set_counter(&mut self, v: Counter) { - self.counter = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_counter(&mut self) -> &mut Counter { - if self.counter.is_none() { - self.counter.set_default(); - } - self.counter.as_mut().unwrap() - } - - // Take field - pub fn take_counter(&mut self) -> Counter { - self.counter.take().unwrap_or_else(|| Counter::new()) - } - - pub fn get_counter(&self) -> &Counter { - self.counter.as_ref().unwrap_or_else(|| Counter::default_instance()) - } - - fn get_counter_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.counter - } - - fn mut_counter_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.counter - } - - // optional .io.prometheus.client.Summary summary = 4; - - pub fn clear_summary(&mut self) { - self.summary.clear(); - } - - pub fn has_summary(&self) -> bool { - self.summary.is_some() - } - - // Param is passed by value, moved - pub fn set_summary(&mut self, v: Summary) { - self.summary = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_summary(&mut self) -> &mut Summary { - if self.summary.is_none() { - self.summary.set_default(); - } - self.summary.as_mut().unwrap() - } - - // Take field - pub fn take_summary(&mut self) -> Summary { - self.summary.take().unwrap_or_else(|| Summary::new()) - } - - pub fn get_summary(&self) -> &Summary { - self.summary.as_ref().unwrap_or_else(|| Summary::default_instance()) - } - - fn get_summary_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.summary - } - - fn mut_summary_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.summary - } - - // optional .io.prometheus.client.Untyped untyped = 5; - - pub fn clear_untyped(&mut self) { - self.untyped.clear(); - } - - pub fn has_untyped(&self) -> bool { - self.untyped.is_some() - } - - // Param is passed by value, moved - pub fn set_untyped(&mut self, v: Untyped) { - self.untyped = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_untyped(&mut self) -> &mut Untyped { - if self.untyped.is_none() { - self.untyped.set_default(); - } - self.untyped.as_mut().unwrap() - } - - // Take field - pub fn take_untyped(&mut self) -> Untyped { - self.untyped.take().unwrap_or_else(|| Untyped::new()) - } - - pub fn get_untyped(&self) -> &Untyped { - self.untyped.as_ref().unwrap_or_else(|| Untyped::default_instance()) - } - - fn get_untyped_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.untyped - } - - fn mut_untyped_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.untyped - } - - // optional .io.prometheus.client.Histogram histogram = 7; - - pub fn clear_histogram(&mut self) { - self.histogram.clear(); - } - - pub fn has_histogram(&self) -> bool { - self.histogram.is_some() - } - - // Param is passed by value, moved - pub fn set_histogram(&mut self, v: Histogram) { - self.histogram = ::protobuf::SingularPtrField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_histogram(&mut self) -> &mut Histogram { - if self.histogram.is_none() { - self.histogram.set_default(); - } - self.histogram.as_mut().unwrap() - } - - // Take field - pub fn take_histogram(&mut self) -> Histogram { - self.histogram.take().unwrap_or_else(|| Histogram::new()) - } - - pub fn get_histogram(&self) -> &Histogram { - self.histogram.as_ref().unwrap_or_else(|| Histogram::default_instance()) - } - - fn get_histogram_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.histogram - } - - fn mut_histogram_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.histogram - } - - // optional int64 timestamp_ms = 6; - - pub fn clear_timestamp_ms(&mut self) { - self.timestamp_ms = ::std::option::Option::None; - } - - pub fn has_timestamp_ms(&self) -> bool { - self.timestamp_ms.is_some() - } - - // Param is passed by value, moved - pub fn set_timestamp_ms(&mut self, v: i64) { - self.timestamp_ms = ::std::option::Option::Some(v); - } - - pub fn get_timestamp_ms(&self) -> i64 { - self.timestamp_ms.unwrap_or(0) - } - - fn get_timestamp_ms_for_reflect(&self) -> &::std::option::Option { - &self.timestamp_ms - } - - fn mut_timestamp_ms_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.timestamp_ms - } -} - -impl ::protobuf::Message for Metric { - fn is_initialized(&self) -> bool { - for v in &self.label { - if !v.is_initialized() { - return false; - } - }; - for v in &self.gauge { - if !v.is_initialized() { - return false; - } - }; - for v in &self.counter { - if !v.is_initialized() { - return false; - } - }; - for v in &self.summary { - if !v.is_initialized() { - return false; - } - }; - for v in &self.untyped { - if !v.is_initialized() { - return false; - } - }; - for v in &self.histogram { - if !v.is_initialized() { - return false; - } - }; - 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 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.label)?; - }, - 2 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.gauge)?; - }, - 3 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.counter)?; - }, - 4 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.summary)?; - }, - 5 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.untyped)?; - }, - 7 => { - ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.histogram)?; - }, - 6 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_int64()?; - self.timestamp_ms = ::std::option::Option::Some(tmp); - }, - _ => { - ::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; - for value in &self.label { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - if let Some(ref v) = self.gauge.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.counter.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.summary.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.untyped.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(ref v) = self.histogram.as_ref() { - let len = v.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - } - if let Some(v) = self.timestamp_ms { - my_size += ::protobuf::rt::value_size(6, 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<()> { - for v in &self.label { - os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - if let Some(ref v) = self.gauge.as_ref() { - os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.counter.as_ref() { - os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.summary.as_ref() { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.untyped.as_ref() { - os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(ref v) = self.histogram.as_ref() { - os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - } - if let Some(v) = self.timestamp_ms { - os.write_int64(6, 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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for Metric { - fn new() -> Metric { - Metric::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "label", - Metric::get_label_for_reflect, - Metric::mut_label_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "gauge", - Metric::get_gauge_for_reflect, - Metric::mut_gauge_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "counter", - Metric::get_counter_for_reflect, - Metric::mut_counter_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "summary", - Metric::get_summary_for_reflect, - Metric::mut_summary_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "untyped", - Metric::get_untyped_for_reflect, - Metric::mut_untyped_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "histogram", - Metric::get_histogram_for_reflect, - Metric::mut_histogram_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( - "timestamp_ms", - Metric::get_timestamp_ms_for_reflect, - Metric::mut_timestamp_ms_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "Metric", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for Metric { - fn clear(&mut self) { - self.clear_label(); - self.clear_gauge(); - self.clear_counter(); - self.clear_summary(); - self.clear_untyped(); - self.clear_histogram(); - self.clear_timestamp_ms(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for Metric { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for Metric { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(PartialEq,Clone,Default)] -pub struct MetricFamily { - // message fields - name: ::protobuf::SingularField<::std::string::String>, - help: ::protobuf::SingularField<::std::string::String>, - field_type: ::std::option::Option, - metric: ::protobuf::RepeatedField, - // special fields - unknown_fields: ::protobuf::UnknownFields, - cached_size: ::protobuf::CachedSize, -} - -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MetricFamily {} - -impl MetricFamily { - pub fn new() -> MetricFamily { - ::std::default::Default::default() - } - - pub fn default_instance() -> &'static MetricFamily { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MetricFamily, - }; - unsafe { - instance.get(MetricFamily::new) - } - } - - // optional string name = 1; - - pub fn clear_name(&mut self) { - self.name.clear(); - } - - pub fn has_name(&self) -> bool { - self.name.is_some() - } - - // Param is passed by value, moved - pub fn set_name(&mut self, v: ::std::string::String) { - self.name = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_name(&mut self) -> &mut ::std::string::String { - if self.name.is_none() { - self.name.set_default(); - } - self.name.as_mut().unwrap() - } - - // Take field - pub fn take_name(&mut self) -> ::std::string::String { - self.name.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_name(&self) -> &str { - match self.name.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.name - } - - // optional string help = 2; - - pub fn clear_help(&mut self) { - self.help.clear(); - } - - pub fn has_help(&self) -> bool { - self.help.is_some() - } - - // Param is passed by value, moved - pub fn set_help(&mut self, v: ::std::string::String) { - self.help = ::protobuf::SingularField::some(v); - } - - // Mutable pointer to the field. - // If field is not initialized, it is initialized with default value first. - pub fn mut_help(&mut self) -> &mut ::std::string::String { - if self.help.is_none() { - self.help.set_default(); - } - self.help.as_mut().unwrap() - } - - // Take field - pub fn take_help(&mut self) -> ::std::string::String { - self.help.take().unwrap_or_else(|| ::std::string::String::new()) - } - - pub fn get_help(&self) -> &str { - match self.help.as_ref() { - Some(v) => &v, - None => "", - } - } - - fn get_help_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.help - } - - fn mut_help_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.help - } - - // optional .io.prometheus.client.MetricType type = 3; - - pub fn clear_field_type(&mut self) { - self.field_type = ::std::option::Option::None; - } - - pub fn has_field_type(&self) -> bool { - self.field_type.is_some() - } - - // Param is passed by value, moved - pub fn set_field_type(&mut self, v: MetricType) { - self.field_type = ::std::option::Option::Some(v); - } - - pub fn get_field_type(&self) -> MetricType { - self.field_type.unwrap_or(MetricType::COUNTER) - } - - fn get_field_type_for_reflect(&self) -> &::std::option::Option { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.field_type - } - - // repeated .io.prometheus.client.Metric metric = 4; - - pub fn clear_metric(&mut self) { - self.metric.clear(); - } - - // Param is passed by value, moved - pub fn set_metric(&mut self, v: ::protobuf::RepeatedField) { - self.metric = v; - } - - // Mutable pointer to the field. - pub fn mut_metric(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.metric - } - - // Take field - pub fn take_metric(&mut self) -> ::protobuf::RepeatedField { - ::std::mem::replace(&mut self.metric, ::protobuf::RepeatedField::new()) - } - - pub fn get_metric(&self) -> &[Metric] { - &self.metric - } - - fn get_metric_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.metric - } - - fn mut_metric_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.metric - } -} - -impl ::protobuf::Message for MetricFamily { - fn is_initialized(&self) -> bool { - for v in &self.metric { - if !v.is_initialized() { - return false; - } - }; - 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 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?; - }, - 2 => { - ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.help)?; - }, - 3 => { - if wire_type != ::protobuf::wire_format::WireTypeVarint { - return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); - } - let tmp = is.read_enum()?; - self.field_type = ::std::option::Option::Some(tmp); - }, - 4 => { - ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.metric)?; - }, - _ => { - ::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(ref v) = self.name.as_ref() { - my_size += ::protobuf::rt::string_size(1, &v); - } - if let Some(ref v) = self.help.as_ref() { - my_size += ::protobuf::rt::string_size(2, &v); - } - if let Some(v) = self.field_type { - my_size += ::protobuf::rt::enum_size(3, v); - } - for value in &self.metric { - let len = value.compute_size(); - my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; - }; - 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(ref v) = self.name.as_ref() { - os.write_string(1, &v)?; - } - if let Some(ref v) = self.help.as_ref() { - os.write_string(2, &v)?; - } - if let Some(v) = self.field_type { - os.write_enum(3, v.value())?; - } - for v in &self.metric { - os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; - os.write_raw_varint32(v.get_cached_size())?; - v.write_to_with_cached_sizes(os)?; - }; - 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 as_any(&self) -> &::std::any::Any { - self as &::std::any::Any - } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any - } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { - self - } - - fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) - } -} - -impl ::protobuf::MessageStatic for MetricFamily { - fn new() -> MetricFamily { - MetricFamily::new() - } - - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, - }; - unsafe { - descriptor.get(|| { - let mut fields = ::std::vec::Vec::new(); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "name", - MetricFamily::get_name_for_reflect, - MetricFamily::mut_name_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( - "help", - MetricFamily::get_help_for_reflect, - MetricFamily::mut_help_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( - "type", - MetricFamily::get_field_type_for_reflect, - MetricFamily::mut_field_type_for_reflect, - )); - fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( - "metric", - MetricFamily::get_metric_for_reflect, - MetricFamily::mut_metric_for_reflect, - )); - ::protobuf::reflect::MessageDescriptor::new::( - "MetricFamily", - fields, - file_descriptor_proto() - ) - }) - } - } -} - -impl ::protobuf::Clear for MetricFamily { - fn clear(&mut self) { - self.clear_name(); - self.clear_help(); - self.clear_field_type(); - self.clear_metric(); - self.unknown_fields.clear(); - } -} - -impl ::std::fmt::Debug for MetricFamily { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - ::protobuf::text_format::fmt(self, f) - } -} - -impl ::protobuf::reflect::ProtobufValue for MetricFamily { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Message(self) - } -} - -#[derive(Clone,PartialEq,Eq,Debug,Hash)] -pub enum MetricType { - COUNTER = 0, - GAUGE = 1, - SUMMARY = 2, - UNTYPED = 3, - HISTOGRAM = 4, -} - -impl ::protobuf::ProtobufEnum for MetricType { - fn value(&self) -> i32 { - *self as i32 - } - - fn from_i32(value: i32) -> ::std::option::Option { - match value { - 0 => ::std::option::Option::Some(MetricType::COUNTER), - 1 => ::std::option::Option::Some(MetricType::GAUGE), - 2 => ::std::option::Option::Some(MetricType::SUMMARY), - 3 => ::std::option::Option::Some(MetricType::UNTYPED), - 4 => ::std::option::Option::Some(MetricType::HISTOGRAM), - _ => ::std::option::Option::None - } - } - - fn values() -> &'static [Self] { - static values: &[MetricType] = &[ - MetricType::COUNTER, - MetricType::GAUGE, - MetricType::SUMMARY, - MetricType::UNTYPED, - MetricType::HISTOGRAM, - ]; - values - } - - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { - static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, - }; - unsafe { - descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("MetricType", file_descriptor_proto()) - }) - } - } -} - -impl ::std::marker::Copy for MetricType { -} - -impl ::protobuf::reflect::ProtobufValue for MetricType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) - } -} - -static file_descriptor_proto_data: &[u8] = b"\ - \n\x13proto/metrics.proto\x12\x14io.prometheus.client\"5\n\tLabelPair\ - \x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x14\n\x05value\x18\ - \x02\x20\x01(\tR\x05value\"\x1d\n\x05Gauge\x12\x14\n\x05value\x18\x01\ - \x20\x01(\x01R\x05value\"\x1f\n\x07Counter\x12\x14\n\x05value\x18\x01\ - \x20\x01(\x01R\x05value\"<\n\x08Quantile\x12\x1a\n\x08quantile\x18\x01\ - \x20\x01(\x01R\x08quantile\x12\x14\n\x05value\x18\x02\x20\x01(\x01R\x05v\ - alue\"\x87\x01\n\x07Summary\x12!\n\x0csample_count\x18\x01\x20\x01(\x04R\ - \x0bsampleCount\x12\x1d\n\nsample_sum\x18\x02\x20\x01(\x01R\tsampleSum\ - \x12:\n\x08quantile\x18\x03\x20\x03(\x0b2\x1e.io.prometheus.client.Quant\ - ileR\x08quantile\"\x1f\n\x07Untyped\x12\x14\n\x05value\x18\x01\x20\x01(\ - \x01R\x05value\"\x83\x01\n\tHistogram\x12!\n\x0csample_count\x18\x01\x20\ - \x01(\x04R\x0bsampleCount\x12\x1d\n\nsample_sum\x18\x02\x20\x01(\x01R\ts\ - ampleSum\x124\n\x06bucket\x18\x03\x20\x03(\x0b2\x1c.io.prometheus.client\ - .BucketR\x06bucket\"T\n\x06Bucket\x12)\n\x10cumulative_count\x18\x01\x20\ - \x01(\x04R\x0fcumulativeCount\x12\x1f\n\x0bupper_bound\x18\x02\x20\x01(\ - \x01R\nupperBound\"\xff\x02\n\x06Metric\x125\n\x05label\x18\x01\x20\x03(\ - \x0b2\x1f.io.prometheus.client.LabelPairR\x05label\x121\n\x05gauge\x18\ - \x02\x20\x01(\x0b2\x1b.io.prometheus.client.GaugeR\x05gauge\x127\n\x07co\ - unter\x18\x03\x20\x01(\x0b2\x1d.io.prometheus.client.CounterR\x07counter\ - \x127\n\x07summary\x18\x04\x20\x01(\x0b2\x1d.io.prometheus.client.Summar\ - yR\x07summary\x127\n\x07untyped\x18\x05\x20\x01(\x0b2\x1d.io.prometheus.\ - client.UntypedR\x07untyped\x12=\n\thistogram\x18\x07\x20\x01(\x0b2\x1f.i\ - o.prometheus.client.HistogramR\thistogram\x12!\n\x0ctimestamp_ms\x18\x06\ - \x20\x01(\x03R\x0btimestampMs\"\xa2\x01\n\x0cMetricFamily\x12\x12\n\x04n\ - ame\x18\x01\x20\x01(\tR\x04name\x12\x12\n\x04help\x18\x02\x20\x01(\tR\ - \x04help\x124\n\x04type\x18\x03\x20\x01(\x0e2\x20.io.prometheus.client.M\ - etricTypeR\x04type\x124\n\x06metric\x18\x04\x20\x03(\x0b2\x1c.io.prometh\ - eus.client.MetricR\x06metric*M\n\nMetricType\x12\x0b\n\x07COUNTER\x10\0\ - \x12\t\n\x05GAUGE\x10\x01\x12\x0b\n\x07SUMMARY\x10\x02\x12\x0b\n\x07UNTY\ - PED\x10\x03\x12\r\n\tHISTOGRAM\x10\x04B\x16\n\x14io.prometheus.clientJ\ - \xf3\x17\n\x06\x12\x04\r\0P\x01\n\xbc\x04\n\x01\x0c\x12\x03\r\0\x122\xb1\ - \x04\x20Copyright\x202013\x20Prometheus\x20Team\n\x20Licensed\x20under\ - \x20the\x20Apache\x20License,\x20Version\x202.0\x20(the\x20\"License\");\ - \n\x20you\x20may\x20not\x20use\x20this\x20file\x20except\x20in\x20compli\ - ance\x20with\x20the\x20License.\n\x20You\x20may\x20obtain\x20a\x20copy\ - \x20of\x20the\x20License\x20at\n\n\x20http://www.apache.org/licenses/LIC\ - ENSE-2.0\n\n\x20Unless\x20required\x20by\x20applicable\x20law\x20or\x20a\ - greed\x20to\x20in\x20writing,\x20software\n\x20distributed\x20under\x20t\ - he\x20License\x20is\x20distributed\x20on\x20an\x20\"AS\x20IS\"\x20BASIS,\ - \n\x20WITHOUT\x20WARRANTIES\x20OR\x20CONDITIONS\x20OF\x20ANY\x20KIND,\ - \x20either\x20express\x20or\x20implied.\n\x20See\x20the\x20License\x20fo\ - r\x20the\x20specific\x20language\x20governing\x20permissions\x20and\n\ - \x20limitations\x20under\x20the\x20License.\n\n\x08\n\x01\x02\x12\x03\ - \x0f\x08\x1c\n\x08\n\x01\x08\x12\x03\x10\0-\n\x0b\n\x04\x08\xe7\x07\0\ - \x12\x03\x10\0-\n\x0c\n\x05\x08\xe7\x07\0\x02\x12\x03\x10\x07\x13\n\r\n\ - \x06\x08\xe7\x07\0\x02\0\x12\x03\x10\x07\x13\n\x0e\n\x07\x08\xe7\x07\0\ - \x02\0\x01\x12\x03\x10\x07\x13\n\x0c\n\x05\x08\xe7\x07\0\x07\x12\x03\x10\ - \x16,\n\n\n\x02\x04\0\x12\x04\x12\0\x15\x01\n\n\n\x03\x04\0\x01\x12\x03\ - \x12\x08\x11\n\x0b\n\x04\x04\0\x02\0\x12\x03\x13\x02\x1c\n\x0c\n\x05\x04\ - \0\x02\0\x04\x12\x03\x13\x02\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x13\ - \x0b\x11\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x13\x12\x16\n\x0c\n\x05\x04\ - \0\x02\0\x03\x12\x03\x13\x1a\x1b\n\x0b\n\x04\x04\0\x02\x01\x12\x03\x14\ - \x02\x1c\n\x0c\n\x05\x04\0\x02\x01\x04\x12\x03\x14\x02\n\n\x0c\n\x05\x04\ - \0\x02\x01\x05\x12\x03\x14\x0b\x11\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ - \x14\x12\x17\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x14\x1a\x1b\n\n\n\x02\ - \x05\0\x12\x04\x17\0\x1d\x01\n\n\n\x03\x05\0\x01\x12\x03\x17\x05\x0f\n\ - \x0b\n\x04\x05\0\x02\0\x12\x03\x18\x02\x11\n\x0c\n\x05\x05\0\x02\0\x01\ - \x12\x03\x18\x02\t\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x18\x0f\x10\n\x0b\ - \n\x04\x05\0\x02\x01\x12\x03\x19\x02\x11\n\x0c\n\x05\x05\0\x02\x01\x01\ - \x12\x03\x19\x02\x07\n\x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x19\x0f\x10\n\ - \x0b\n\x04\x05\0\x02\x02\x12\x03\x1a\x02\x11\n\x0c\n\x05\x05\0\x02\x02\ - \x01\x12\x03\x1a\x02\t\n\x0c\n\x05\x05\0\x02\x02\x02\x12\x03\x1a\x0f\x10\ - \n\x0b\n\x04\x05\0\x02\x03\x12\x03\x1b\x02\x11\n\x0c\n\x05\x05\0\x02\x03\ - \x01\x12\x03\x1b\x02\t\n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\x1b\x0f\x10\ - \n\x0b\n\x04\x05\0\x02\x04\x12\x03\x1c\x02\x11\n\x0c\n\x05\x05\0\x02\x04\ - \x01\x12\x03\x1c\x02\x0b\n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03\x1c\x0f\ - \x10\n\n\n\x02\x04\x01\x12\x04\x1f\0!\x01\n\n\n\x03\x04\x01\x01\x12\x03\ - \x1f\x08\r\n\x0b\n\x04\x04\x01\x02\0\x12\x03\x20\x02\x1c\n\x0c\n\x05\x04\ - \x01\x02\0\x04\x12\x03\x20\x02\n\n\x0c\n\x05\x04\x01\x02\0\x05\x12\x03\ - \x20\x0b\x11\n\x0c\n\x05\x04\x01\x02\0\x01\x12\x03\x20\x12\x17\n\x0c\n\ - \x05\x04\x01\x02\0\x03\x12\x03\x20\x1a\x1b\n\n\n\x02\x04\x02\x12\x04#\0%\ - \x01\n\n\n\x03\x04\x02\x01\x12\x03#\x08\x0f\n\x0b\n\x04\x04\x02\x02\0\ - \x12\x03$\x02\x1c\n\x0c\n\x05\x04\x02\x02\0\x04\x12\x03$\x02\n\n\x0c\n\ - \x05\x04\x02\x02\0\x05\x12\x03$\x0b\x11\n\x0c\n\x05\x04\x02\x02\0\x01\ - \x12\x03$\x12\x17\n\x0c\n\x05\x04\x02\x02\0\x03\x12\x03$\x1a\x1b\n\n\n\ - \x02\x04\x03\x12\x04'\0*\x01\n\n\n\x03\x04\x03\x01\x12\x03'\x08\x10\n\ - \x0b\n\x04\x04\x03\x02\0\x12\x03(\x02\x1f\n\x0c\n\x05\x04\x03\x02\0\x04\ - \x12\x03(\x02\n\n\x0c\n\x05\x04\x03\x02\0\x05\x12\x03(\x0b\x11\n\x0c\n\ - \x05\x04\x03\x02\0\x01\x12\x03(\x12\x1a\n\x0c\n\x05\x04\x03\x02\0\x03\ - \x12\x03(\x1d\x1e\n\x0b\n\x04\x04\x03\x02\x01\x12\x03)\x02\x1f\n\x0c\n\ - \x05\x04\x03\x02\x01\x04\x12\x03)\x02\n\n\x0c\n\x05\x04\x03\x02\x01\x05\ - \x12\x03)\x0b\x11\n\x0c\n\x05\x04\x03\x02\x01\x01\x12\x03)\x12\x17\n\x0c\ - \n\x05\x04\x03\x02\x01\x03\x12\x03)\x1d\x1e\n\n\n\x02\x04\x04\x12\x04,\0\ - 0\x01\n\n\n\x03\x04\x04\x01\x12\x03,\x08\x0f\n\x0b\n\x04\x04\x04\x02\0\ - \x12\x03-\x02%\n\x0c\n\x05\x04\x04\x02\0\x04\x12\x03-\x02\n\n\x0c\n\x05\ - \x04\x04\x02\0\x05\x12\x03-\x0b\x11\n\x0c\n\x05\x04\x04\x02\0\x01\x12\ - \x03-\x14\x20\n\x0c\n\x05\x04\x04\x02\0\x03\x12\x03-#$\n\x0b\n\x04\x04\ - \x04\x02\x01\x12\x03.\x02%\n\x0c\n\x05\x04\x04\x02\x01\x04\x12\x03.\x02\ - \n\n\x0c\n\x05\x04\x04\x02\x01\x05\x12\x03.\x0b\x11\n\x0c\n\x05\x04\x04\ - \x02\x01\x01\x12\x03.\x14\x1e\n\x0c\n\x05\x04\x04\x02\x01\x03\x12\x03.#$\ - \n\x0b\n\x04\x04\x04\x02\x02\x12\x03/\x02%\n\x0c\n\x05\x04\x04\x02\x02\ - \x04\x12\x03/\x02\n\n\x0c\n\x05\x04\x04\x02\x02\x06\x12\x03/\x0b\x13\n\ - \x0c\n\x05\x04\x04\x02\x02\x01\x12\x03/\x14\x1c\n\x0c\n\x05\x04\x04\x02\ - \x02\x03\x12\x03/#$\n\n\n\x02\x04\x05\x12\x042\04\x01\n\n\n\x03\x04\x05\ - \x01\x12\x032\x08\x0f\n\x0b\n\x04\x04\x05\x02\0\x12\x033\x02\x1c\n\x0c\n\ - \x05\x04\x05\x02\0\x04\x12\x033\x02\n\n\x0c\n\x05\x04\x05\x02\0\x05\x12\ - \x033\x0b\x11\n\x0c\n\x05\x04\x05\x02\0\x01\x12\x033\x12\x17\n\x0c\n\x05\ - \x04\x05\x02\0\x03\x12\x033\x1a\x1b\n\n\n\x02\x04\x06\x12\x046\0:\x01\n\ - \n\n\x03\x04\x06\x01\x12\x036\x08\x11\n\x0b\n\x04\x04\x06\x02\0\x12\x037\ - \x02#\n\x0c\n\x05\x04\x06\x02\0\x04\x12\x037\x02\n\n\x0c\n\x05\x04\x06\ - \x02\0\x05\x12\x037\x0b\x11\n\x0c\n\x05\x04\x06\x02\0\x01\x12\x037\x12\ - \x1e\n\x0c\n\x05\x04\x06\x02\0\x03\x12\x037!\"\n\x0b\n\x04\x04\x06\x02\ - \x01\x12\x038\x02#\n\x0c\n\x05\x04\x06\x02\x01\x04\x12\x038\x02\n\n\x0c\ - \n\x05\x04\x06\x02\x01\x05\x12\x038\x0b\x11\n\x0c\n\x05\x04\x06\x02\x01\ - \x01\x12\x038\x12\x1c\n\x0c\n\x05\x04\x06\x02\x01\x03\x12\x038!\"\nS\n\ - \x04\x04\x06\x02\x02\x12\x039\x02#\"F\x20Ordered\x20in\x20increasing\x20\ - order\x20of\x20upper_bound,\x20+Inf\x20bucket\x20is\x20optional.\n\n\x0c\ - \n\x05\x04\x06\x02\x02\x04\x12\x039\x02\n\n\x0c\n\x05\x04\x06\x02\x02\ - \x06\x12\x039\x0b\x11\n\x0c\n\x05\x04\x06\x02\x02\x01\x12\x039\x12\x18\n\ - \x0c\n\x05\x04\x06\x02\x02\x03\x12\x039!\"\n\n\n\x02\x04\x07\x12\x04<\0?\ - \x01\n\n\n\x03\x04\x07\x01\x12\x03<\x08\x0e\n.\n\x04\x04\x07\x02\0\x12\ - \x03=\x02'\"!\x20Cumulative\x20in\x20increasing\x20order.\n\n\x0c\n\x05\ - \x04\x07\x02\0\x04\x12\x03=\x02\n\n\x0c\n\x05\x04\x07\x02\0\x05\x12\x03=\ - \x0b\x11\n\x0c\n\x05\x04\x07\x02\0\x01\x12\x03=\x12\"\n\x0c\n\x05\x04\ - \x07\x02\0\x03\x12\x03=%&\n\x19\n\x04\x04\x07\x02\x01\x12\x03>\x02\"\"\ - \x0c\x20Inclusive.\n\n\x0c\n\x05\x04\x07\x02\x01\x04\x12\x03>\x02\n\n\ - \x0c\n\x05\x04\x07\x02\x01\x05\x12\x03>\x0b\x11\n\x0c\n\x05\x04\x07\x02\ - \x01\x01\x12\x03>\x12\x1d\n\x0c\n\x05\x04\x07\x02\x01\x03\x12\x03>\x20!\ - \n\n\n\x02\x04\x08\x12\x04A\0I\x01\n\n\n\x03\x04\x08\x01\x12\x03A\x08\ - \x0e\n\x0b\n\x04\x04\x08\x02\0\x12\x03B\x02&\n\x0c\n\x05\x04\x08\x02\0\ - \x04\x12\x03B\x02\n\n\x0c\n\x05\x04\x08\x02\0\x06\x12\x03B\x0b\x14\n\x0c\ - \n\x05\x04\x08\x02\0\x01\x12\x03B\x15\x1a\n\x0c\n\x05\x04\x08\x02\0\x03\ - \x12\x03B$%\n\x0b\n\x04\x04\x08\x02\x01\x12\x03C\x02&\n\x0c\n\x05\x04\ - \x08\x02\x01\x04\x12\x03C\x02\n\n\x0c\n\x05\x04\x08\x02\x01\x06\x12\x03C\ - \x0b\x10\n\x0c\n\x05\x04\x08\x02\x01\x01\x12\x03C\x15\x1a\n\x0c\n\x05\ - \x04\x08\x02\x01\x03\x12\x03C$%\n\x0b\n\x04\x04\x08\x02\x02\x12\x03D\x02\ - &\n\x0c\n\x05\x04\x08\x02\x02\x04\x12\x03D\x02\n\n\x0c\n\x05\x04\x08\x02\ - \x02\x06\x12\x03D\x0b\x12\n\x0c\n\x05\x04\x08\x02\x02\x01\x12\x03D\x15\ - \x1c\n\x0c\n\x05\x04\x08\x02\x02\x03\x12\x03D$%\n\x0b\n\x04\x04\x08\x02\ - \x03\x12\x03E\x02&\n\x0c\n\x05\x04\x08\x02\x03\x04\x12\x03E\x02\n\n\x0c\ - \n\x05\x04\x08\x02\x03\x06\x12\x03E\x0b\x12\n\x0c\n\x05\x04\x08\x02\x03\ - \x01\x12\x03E\x15\x1c\n\x0c\n\x05\x04\x08\x02\x03\x03\x12\x03E$%\n\x0b\n\ - \x04\x04\x08\x02\x04\x12\x03F\x02&\n\x0c\n\x05\x04\x08\x02\x04\x04\x12\ - \x03F\x02\n\n\x0c\n\x05\x04\x08\x02\x04\x06\x12\x03F\x0b\x12\n\x0c\n\x05\ - \x04\x08\x02\x04\x01\x12\x03F\x15\x1c\n\x0c\n\x05\x04\x08\x02\x04\x03\ - \x12\x03F$%\n\x0b\n\x04\x04\x08\x02\x05\x12\x03G\x02&\n\x0c\n\x05\x04\ - \x08\x02\x05\x04\x12\x03G\x02\n\n\x0c\n\x05\x04\x08\x02\x05\x06\x12\x03G\ - \x0b\x14\n\x0c\n\x05\x04\x08\x02\x05\x01\x12\x03G\x15\x1e\n\x0c\n\x05\ - \x04\x08\x02\x05\x03\x12\x03G$%\n\x0b\n\x04\x04\x08\x02\x06\x12\x03H\x02\ - &\n\x0c\n\x05\x04\x08\x02\x06\x04\x12\x03H\x02\n\n\x0c\n\x05\x04\x08\x02\ - \x06\x05\x12\x03H\x0b\x10\n\x0c\n\x05\x04\x08\x02\x06\x01\x12\x03H\x15!\ - \n\x0c\n\x05\x04\x08\x02\x06\x03\x12\x03H$%\n\n\n\x02\x04\t\x12\x04K\0P\ - \x01\n\n\n\x03\x04\t\x01\x12\x03K\x08\x14\n\x0b\n\x04\x04\t\x02\0\x12\ - \x03L\x02!\n\x0c\n\x05\x04\t\x02\0\x04\x12\x03L\x02\n\n\x0c\n\x05\x04\t\ - \x02\0\x05\x12\x03L\x0b\x11\n\x0c\n\x05\x04\t\x02\0\x01\x12\x03L\x16\x1a\ - \n\x0c\n\x05\x04\t\x02\0\x03\x12\x03L\x1f\x20\n\x0b\n\x04\x04\t\x02\x01\ - \x12\x03M\x02!\n\x0c\n\x05\x04\t\x02\x01\x04\x12\x03M\x02\n\n\x0c\n\x05\ - \x04\t\x02\x01\x05\x12\x03M\x0b\x11\n\x0c\n\x05\x04\t\x02\x01\x01\x12\ - \x03M\x16\x1a\n\x0c\n\x05\x04\t\x02\x01\x03\x12\x03M\x1f\x20\n\x0b\n\x04\ - \x04\t\x02\x02\x12\x03N\x02!\n\x0c\n\x05\x04\t\x02\x02\x04\x12\x03N\x02\ - \n\n\x0c\n\x05\x04\t\x02\x02\x06\x12\x03N\x0b\x15\n\x0c\n\x05\x04\t\x02\ - \x02\x01\x12\x03N\x16\x1a\n\x0c\n\x05\x04\t\x02\x02\x03\x12\x03N\x1f\x20\ - \n\x0b\n\x04\x04\t\x02\x03\x12\x03O\x02!\n\x0c\n\x05\x04\t\x02\x03\x04\ - \x12\x03O\x02\n\n\x0c\n\x05\x04\t\x02\x03\x06\x12\x03O\x0b\x11\n\x0c\n\ - \x05\x04\t\x02\x03\x01\x12\x03O\x16\x1c\n\x0c\n\x05\x04\t\x02\x03\x03\ - \x12\x03O\x1f\x20\ -"; - -static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, -}; - -fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { - ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() -} - -pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { - unsafe { - file_descriptor_proto_lazy.get(|| { - parse_descriptor_proto() - }) - } -} From b91c711fa9b76abc910f56b0ca1c612b53c1524d Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Mon, 14 May 2018 11:30:24 +0800 Subject: [PATCH 2/9] auto generate protobuf binding file when set `gen` feature --- Cargo.toml | 1 + build.rs | 18 +- proto/metrics.rs | 2532 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 2543 insertions(+), 8 deletions(-) create mode 100644 proto/metrics.rs diff --git a/Cargo.toml b/Cargo.toml index b45f3f2e..eb74ddc8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ dev = ["clippy"] nightly = ["libc", "spin/unstable"] push = ["hyper", "libc"] process = ["libc", "procinfo"] +gen = [] [[bench]] name = "benches" diff --git a/build.rs b/build.rs index 6d7f4dbe..ad801540 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,14 @@ extern crate protoc_rust; fn main() { - protoc_rust::run(protoc_rust::Args { - out_dir: "proto", - input: &["proto/metrics.proto"], - includes: &["proto"], - customize: protoc_rust::Customize { - ..Default::default() - }, - }).expect("protoc"); + if cfg!(feature = "gen") { + protoc_rust::run(protoc_rust::Args { + out_dir: "proto", + input: &["proto/metrics.proto"], + includes: &["proto"], + customize: protoc_rust::Customize { + ..Default::default() + }, + }).expect("protoc"); + } } diff --git a/proto/metrics.rs b/proto/metrics.rs new file mode 100644 index 00000000..e1a419aa --- /dev/null +++ b/proto/metrics.rs @@ -0,0 +1,2532 @@ +// This file is generated by rust-protobuf 1.6.0. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy)] + +#![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(unsafe_code)] +#![allow(unused_imports)] +#![allow(unused_results)] + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct LabelPair { + // message fields + name: ::protobuf::SingularField<::std::string::String>, + value: ::protobuf::SingularField<::std::string::String>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl LabelPair { + pub fn new() -> LabelPair { + ::std::default::Default::default() + } + + // optional string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name.set_default(); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + match self.name.as_ref() { + Some(v) => &v, + None => "", + } + } + + // optional string value = 2; + + pub fn clear_value(&mut self) { + self.value.clear(); + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: ::std::string::String) { + self.value = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_value(&mut self) -> &mut ::std::string::String { + if self.value.is_none() { + self.value.set_default(); + } + self.value.as_mut().unwrap() + } + + // Take field + pub fn take_value(&mut self) -> ::std::string::String { + self.value.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_value(&self) -> &str { + match self.value.as_ref() { + Some(v) => &v, + None => "", + } + } +} + +impl ::protobuf::Message for LabelPair { + 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 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.value)?; + }, + _ => { + ::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(ref v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.value.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + 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(ref v) = self.name.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.value.as_ref() { + os.write_string(2, &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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> LabelPair { + LabelPair::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &LabelPair| { &m.name }, + |m: &mut LabelPair| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "value", + |m: &LabelPair| { &m.value }, + |m: &mut LabelPair| { &mut m.value }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "LabelPair", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static LabelPair { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LabelPair, + }; + unsafe { + instance.get(LabelPair::new) + } + } +} + +impl ::protobuf::Clear for LabelPair { + fn clear(&mut self) { + self.clear_name(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for LabelPair { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for LabelPair { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Gauge { + // message fields + value: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Gauge { + pub fn new() -> Gauge { + ::std::default::Default::default() + } + + // optional double value = 1; + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: f64) { + self.value = ::std::option::Option::Some(v); + } + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } +} + +impl ::protobuf::Message for Gauge { + 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::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.value = ::std::option::Option::Some(tmp); + }, + _ => { + ::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.value { + my_size += 9; + } + 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.value { + os.write_double(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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Gauge { + Gauge::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "value", + |m: &Gauge| { &m.value }, + |m: &mut Gauge| { &mut m.value }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Gauge", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Gauge { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Gauge, + }; + unsafe { + instance.get(Gauge::new) + } + } +} + +impl ::protobuf::Clear for Gauge { + fn clear(&mut self) { + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Gauge { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Gauge { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Counter { + // message fields + value: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Counter { + pub fn new() -> Counter { + ::std::default::Default::default() + } + + // optional double value = 1; + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: f64) { + self.value = ::std::option::Option::Some(v); + } + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } +} + +impl ::protobuf::Message for Counter { + 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::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.value = ::std::option::Option::Some(tmp); + }, + _ => { + ::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.value { + my_size += 9; + } + 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.value { + os.write_double(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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Counter { + Counter::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "value", + |m: &Counter| { &m.value }, + |m: &mut Counter| { &mut m.value }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Counter", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Counter { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Counter, + }; + unsafe { + instance.get(Counter::new) + } + } +} + +impl ::protobuf::Clear for Counter { + fn clear(&mut self) { + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Counter { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Counter { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Quantile { + // message fields + quantile: ::std::option::Option, + value: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Quantile { + pub fn new() -> Quantile { + ::std::default::Default::default() + } + + // optional double quantile = 1; + + pub fn clear_quantile(&mut self) { + self.quantile = ::std::option::Option::None; + } + + pub fn has_quantile(&self) -> bool { + self.quantile.is_some() + } + + // Param is passed by value, moved + pub fn set_quantile(&mut self, v: f64) { + self.quantile = ::std::option::Option::Some(v); + } + + pub fn get_quantile(&self) -> f64 { + self.quantile.unwrap_or(0.) + } + + // optional double value = 2; + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: f64) { + self.value = ::std::option::Option::Some(v); + } + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } +} + +impl ::protobuf::Message for Quantile { + 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::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.quantile = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.value = ::std::option::Option::Some(tmp); + }, + _ => { + ::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.quantile { + my_size += 9; + } + if let Some(v) = self.value { + my_size += 9; + } + 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.quantile { + os.write_double(1, v)?; + } + if let Some(v) = self.value { + os.write_double(2, 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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Quantile { + Quantile::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "quantile", + |m: &Quantile| { &m.quantile }, + |m: &mut Quantile| { &mut m.quantile }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "value", + |m: &Quantile| { &m.value }, + |m: &mut Quantile| { &mut m.value }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Quantile", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Quantile { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Quantile, + }; + unsafe { + instance.get(Quantile::new) + } + } +} + +impl ::protobuf::Clear for Quantile { + fn clear(&mut self) { + self.clear_quantile(); + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Quantile { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Quantile { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Summary { + // message fields + sample_count: ::std::option::Option, + sample_sum: ::std::option::Option, + quantile: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Summary { + pub fn new() -> Summary { + ::std::default::Default::default() + } + + // optional uint64 sample_count = 1; + + pub fn clear_sample_count(&mut self) { + self.sample_count = ::std::option::Option::None; + } + + pub fn has_sample_count(&self) -> bool { + self.sample_count.is_some() + } + + // Param is passed by value, moved + pub fn set_sample_count(&mut self, v: u64) { + self.sample_count = ::std::option::Option::Some(v); + } + + pub fn get_sample_count(&self) -> u64 { + self.sample_count.unwrap_or(0) + } + + // optional double sample_sum = 2; + + pub fn clear_sample_sum(&mut self) { + self.sample_sum = ::std::option::Option::None; + } + + pub fn has_sample_sum(&self) -> bool { + self.sample_sum.is_some() + } + + // Param is passed by value, moved + pub fn set_sample_sum(&mut self, v: f64) { + self.sample_sum = ::std::option::Option::Some(v); + } + + pub fn get_sample_sum(&self) -> f64 { + self.sample_sum.unwrap_or(0.) + } + + // repeated .io.prometheus.client.Quantile quantile = 3; + + pub fn clear_quantile(&mut self) { + self.quantile.clear(); + } + + // Param is passed by value, moved + pub fn set_quantile(&mut self, v: ::protobuf::RepeatedField) { + self.quantile = v; + } + + // Mutable pointer to the field. + pub fn mut_quantile(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.quantile + } + + // Take field + pub fn take_quantile(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.quantile, ::protobuf::RepeatedField::new()) + } + + pub fn get_quantile(&self) -> &[Quantile] { + &self.quantile + } +} + +impl ::protobuf::Message for Summary { + fn is_initialized(&self) -> bool { + for v in &self.quantile { + if !v.is_initialized() { + return false; + } + }; + 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)); + } + let tmp = is.read_uint64()?; + self.sample_count = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.sample_sum = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.quantile)?; + }, + _ => { + ::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.sample_count { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.sample_sum { + my_size += 9; + } + for value in &self.quantile { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + 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.sample_count { + os.write_uint64(1, v)?; + } + if let Some(v) = self.sample_sum { + os.write_double(2, v)?; + } + for v in &self.quantile { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + 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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Summary { + Summary::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "sample_count", + |m: &Summary| { &m.sample_count }, + |m: &mut Summary| { &mut m.sample_count }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "sample_sum", + |m: &Summary| { &m.sample_sum }, + |m: &mut Summary| { &mut m.sample_sum }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "quantile", + |m: &Summary| { &m.quantile }, + |m: &mut Summary| { &mut m.quantile }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Summary", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Summary { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Summary, + }; + unsafe { + instance.get(Summary::new) + } + } +} + +impl ::protobuf::Clear for Summary { + fn clear(&mut self) { + self.clear_sample_count(); + self.clear_sample_sum(); + self.clear_quantile(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Summary { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Summary { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Untyped { + // message fields + value: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Untyped { + pub fn new() -> Untyped { + ::std::default::Default::default() + } + + // optional double value = 1; + + pub fn clear_value(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_value(&self) -> bool { + self.value.is_some() + } + + // Param is passed by value, moved + pub fn set_value(&mut self, v: f64) { + self.value = ::std::option::Option::Some(v); + } + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } +} + +impl ::protobuf::Message for Untyped { + 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::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.value = ::std::option::Option::Some(tmp); + }, + _ => { + ::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.value { + my_size += 9; + } + 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.value { + os.write_double(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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Untyped { + Untyped::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "value", + |m: &Untyped| { &m.value }, + |m: &mut Untyped| { &mut m.value }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Untyped", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Untyped { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Untyped, + }; + unsafe { + instance.get(Untyped::new) + } + } +} + +impl ::protobuf::Clear for Untyped { + fn clear(&mut self) { + self.clear_value(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Untyped { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Untyped { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Histogram { + // message fields + sample_count: ::std::option::Option, + sample_sum: ::std::option::Option, + bucket: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Histogram { + pub fn new() -> Histogram { + ::std::default::Default::default() + } + + // optional uint64 sample_count = 1; + + pub fn clear_sample_count(&mut self) { + self.sample_count = ::std::option::Option::None; + } + + pub fn has_sample_count(&self) -> bool { + self.sample_count.is_some() + } + + // Param is passed by value, moved + pub fn set_sample_count(&mut self, v: u64) { + self.sample_count = ::std::option::Option::Some(v); + } + + pub fn get_sample_count(&self) -> u64 { + self.sample_count.unwrap_or(0) + } + + // optional double sample_sum = 2; + + pub fn clear_sample_sum(&mut self) { + self.sample_sum = ::std::option::Option::None; + } + + pub fn has_sample_sum(&self) -> bool { + self.sample_sum.is_some() + } + + // Param is passed by value, moved + pub fn set_sample_sum(&mut self, v: f64) { + self.sample_sum = ::std::option::Option::Some(v); + } + + pub fn get_sample_sum(&self) -> f64 { + self.sample_sum.unwrap_or(0.) + } + + // repeated .io.prometheus.client.Bucket bucket = 3; + + pub fn clear_bucket(&mut self) { + self.bucket.clear(); + } + + // Param is passed by value, moved + pub fn set_bucket(&mut self, v: ::protobuf::RepeatedField) { + self.bucket = v; + } + + // Mutable pointer to the field. + pub fn mut_bucket(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.bucket + } + + // Take field + pub fn take_bucket(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.bucket, ::protobuf::RepeatedField::new()) + } + + pub fn get_bucket(&self) -> &[Bucket] { + &self.bucket + } +} + +impl ::protobuf::Message for Histogram { + fn is_initialized(&self) -> bool { + for v in &self.bucket { + if !v.is_initialized() { + return false; + } + }; + 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)); + } + let tmp = is.read_uint64()?; + self.sample_count = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.sample_sum = ::std::option::Option::Some(tmp); + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.bucket)?; + }, + _ => { + ::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.sample_count { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.sample_sum { + my_size += 9; + } + for value in &self.bucket { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + 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.sample_count { + os.write_uint64(1, v)?; + } + if let Some(v) = self.sample_sum { + os.write_double(2, v)?; + } + for v in &self.bucket { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + 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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Histogram { + Histogram::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "sample_count", + |m: &Histogram| { &m.sample_count }, + |m: &mut Histogram| { &mut m.sample_count }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "sample_sum", + |m: &Histogram| { &m.sample_sum }, + |m: &mut Histogram| { &mut m.sample_sum }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "bucket", + |m: &Histogram| { &m.bucket }, + |m: &mut Histogram| { &mut m.bucket }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Histogram", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Histogram { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Histogram, + }; + unsafe { + instance.get(Histogram::new) + } + } +} + +impl ::protobuf::Clear for Histogram { + fn clear(&mut self) { + self.clear_sample_count(); + self.clear_sample_sum(); + self.clear_bucket(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Histogram { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Histogram { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Bucket { + // message fields + cumulative_count: ::std::option::Option, + upper_bound: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Bucket { + pub fn new() -> Bucket { + ::std::default::Default::default() + } + + // optional uint64 cumulative_count = 1; + + pub fn clear_cumulative_count(&mut self) { + self.cumulative_count = ::std::option::Option::None; + } + + pub fn has_cumulative_count(&self) -> bool { + self.cumulative_count.is_some() + } + + // Param is passed by value, moved + pub fn set_cumulative_count(&mut self, v: u64) { + self.cumulative_count = ::std::option::Option::Some(v); + } + + pub fn get_cumulative_count(&self) -> u64 { + self.cumulative_count.unwrap_or(0) + } + + // optional double upper_bound = 2; + + pub fn clear_upper_bound(&mut self) { + self.upper_bound = ::std::option::Option::None; + } + + pub fn has_upper_bound(&self) -> bool { + self.upper_bound.is_some() + } + + // Param is passed by value, moved + pub fn set_upper_bound(&mut self, v: f64) { + self.upper_bound = ::std::option::Option::Some(v); + } + + pub fn get_upper_bound(&self) -> f64 { + self.upper_bound.unwrap_or(0.) + } +} + +impl ::protobuf::Message for Bucket { + 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)); + } + let tmp = is.read_uint64()?; + self.cumulative_count = ::std::option::Option::Some(tmp); + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeFixed64 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_double()?; + self.upper_bound = ::std::option::Option::Some(tmp); + }, + _ => { + ::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.cumulative_count { + my_size += ::protobuf::rt::value_size(1, v, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(v) = self.upper_bound { + my_size += 9; + } + 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.cumulative_count { + os.write_uint64(1, v)?; + } + if let Some(v) = self.upper_bound { + os.write_double(2, 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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Bucket { + Bucket::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "cumulative_count", + |m: &Bucket| { &m.cumulative_count }, + |m: &mut Bucket| { &mut m.cumulative_count }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "upper_bound", + |m: &Bucket| { &m.upper_bound }, + |m: &mut Bucket| { &mut m.upper_bound }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Bucket", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Bucket { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Bucket, + }; + unsafe { + instance.get(Bucket::new) + } + } +} + +impl ::protobuf::Clear for Bucket { + fn clear(&mut self) { + self.clear_cumulative_count(); + self.clear_upper_bound(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Bucket { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Bucket { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct Metric { + // message fields + label: ::protobuf::RepeatedField, + gauge: ::protobuf::SingularPtrField, + counter: ::protobuf::SingularPtrField, + summary: ::protobuf::SingularPtrField, + untyped: ::protobuf::SingularPtrField, + histogram: ::protobuf::SingularPtrField, + timestamp_ms: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl Metric { + pub fn new() -> Metric { + ::std::default::Default::default() + } + + // repeated .io.prometheus.client.LabelPair label = 1; + + pub fn clear_label(&mut self) { + self.label.clear(); + } + + // Param is passed by value, moved + pub fn set_label(&mut self, v: ::protobuf::RepeatedField) { + self.label = v; + } + + // Mutable pointer to the field. + pub fn mut_label(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.label + } + + // Take field + pub fn take_label(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.label, ::protobuf::RepeatedField::new()) + } + + pub fn get_label(&self) -> &[LabelPair] { + &self.label + } + + // optional .io.prometheus.client.Gauge gauge = 2; + + pub fn clear_gauge(&mut self) { + self.gauge.clear(); + } + + pub fn has_gauge(&self) -> bool { + self.gauge.is_some() + } + + // Param is passed by value, moved + pub fn set_gauge(&mut self, v: Gauge) { + self.gauge = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gauge(&mut self) -> &mut Gauge { + if self.gauge.is_none() { + self.gauge.set_default(); + } + self.gauge.as_mut().unwrap() + } + + // Take field + pub fn take_gauge(&mut self) -> Gauge { + self.gauge.take().unwrap_or_else(|| Gauge::new()) + } + + pub fn get_gauge(&self) -> &Gauge { + self.gauge.as_ref().unwrap_or_else(|| Gauge::default_instance()) + } + + // optional .io.prometheus.client.Counter counter = 3; + + pub fn clear_counter(&mut self) { + self.counter.clear(); + } + + pub fn has_counter(&self) -> bool { + self.counter.is_some() + } + + // Param is passed by value, moved + pub fn set_counter(&mut self, v: Counter) { + self.counter = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_counter(&mut self) -> &mut Counter { + if self.counter.is_none() { + self.counter.set_default(); + } + self.counter.as_mut().unwrap() + } + + // Take field + pub fn take_counter(&mut self) -> Counter { + self.counter.take().unwrap_or_else(|| Counter::new()) + } + + pub fn get_counter(&self) -> &Counter { + self.counter.as_ref().unwrap_or_else(|| Counter::default_instance()) + } + + // optional .io.prometheus.client.Summary summary = 4; + + pub fn clear_summary(&mut self) { + self.summary.clear(); + } + + pub fn has_summary(&self) -> bool { + self.summary.is_some() + } + + // Param is passed by value, moved + pub fn set_summary(&mut self, v: Summary) { + self.summary = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_summary(&mut self) -> &mut Summary { + if self.summary.is_none() { + self.summary.set_default(); + } + self.summary.as_mut().unwrap() + } + + // Take field + pub fn take_summary(&mut self) -> Summary { + self.summary.take().unwrap_or_else(|| Summary::new()) + } + + pub fn get_summary(&self) -> &Summary { + self.summary.as_ref().unwrap_or_else(|| Summary::default_instance()) + } + + // optional .io.prometheus.client.Untyped untyped = 5; + + pub fn clear_untyped(&mut self) { + self.untyped.clear(); + } + + pub fn has_untyped(&self) -> bool { + self.untyped.is_some() + } + + // Param is passed by value, moved + pub fn set_untyped(&mut self, v: Untyped) { + self.untyped = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_untyped(&mut self) -> &mut Untyped { + if self.untyped.is_none() { + self.untyped.set_default(); + } + self.untyped.as_mut().unwrap() + } + + // Take field + pub fn take_untyped(&mut self) -> Untyped { + self.untyped.take().unwrap_or_else(|| Untyped::new()) + } + + pub fn get_untyped(&self) -> &Untyped { + self.untyped.as_ref().unwrap_or_else(|| Untyped::default_instance()) + } + + // optional .io.prometheus.client.Histogram histogram = 7; + + pub fn clear_histogram(&mut self) { + self.histogram.clear(); + } + + pub fn has_histogram(&self) -> bool { + self.histogram.is_some() + } + + // Param is passed by value, moved + pub fn set_histogram(&mut self, v: Histogram) { + self.histogram = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_histogram(&mut self) -> &mut Histogram { + if self.histogram.is_none() { + self.histogram.set_default(); + } + self.histogram.as_mut().unwrap() + } + + // Take field + pub fn take_histogram(&mut self) -> Histogram { + self.histogram.take().unwrap_or_else(|| Histogram::new()) + } + + pub fn get_histogram(&self) -> &Histogram { + self.histogram.as_ref().unwrap_or_else(|| Histogram::default_instance()) + } + + // optional int64 timestamp_ms = 6; + + pub fn clear_timestamp_ms(&mut self) { + self.timestamp_ms = ::std::option::Option::None; + } + + pub fn has_timestamp_ms(&self) -> bool { + self.timestamp_ms.is_some() + } + + // Param is passed by value, moved + pub fn set_timestamp_ms(&mut self, v: i64) { + self.timestamp_ms = ::std::option::Option::Some(v); + } + + pub fn get_timestamp_ms(&self) -> i64 { + self.timestamp_ms.unwrap_or(0) + } +} + +impl ::protobuf::Message for Metric { + fn is_initialized(&self) -> bool { + for v in &self.label { + if !v.is_initialized() { + return false; + } + }; + for v in &self.gauge { + if !v.is_initialized() { + return false; + } + }; + for v in &self.counter { + if !v.is_initialized() { + return false; + } + }; + for v in &self.summary { + if !v.is_initialized() { + return false; + } + }; + for v in &self.untyped { + if !v.is_initialized() { + return false; + } + }; + for v in &self.histogram { + if !v.is_initialized() { + return false; + } + }; + 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 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.label)?; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.gauge)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.counter)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.summary)?; + }, + 5 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.untyped)?; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.histogram)?; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.timestamp_ms = ::std::option::Option::Some(tmp); + }, + _ => { + ::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; + for value in &self.label { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.gauge.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.counter.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.summary.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.untyped.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(ref v) = self.histogram.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if let Some(v) = self.timestamp_ms { + my_size += ::protobuf::rt::value_size(6, 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<()> { + for v in &self.label { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.gauge.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.counter.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.summary.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.untyped.as_ref() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(ref v) = self.histogram.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if let Some(v) = self.timestamp_ms { + os.write_int64(6, 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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> Metric { + Metric::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "label", + |m: &Metric| { &m.label }, + |m: &mut Metric| { &mut m.label }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "gauge", + |m: &Metric| { &m.gauge }, + |m: &mut Metric| { &mut m.gauge }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "counter", + |m: &Metric| { &m.counter }, + |m: &mut Metric| { &mut m.counter }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "summary", + |m: &Metric| { &m.summary }, + |m: &mut Metric| { &mut m.summary }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "untyped", + |m: &Metric| { &m.untyped }, + |m: &mut Metric| { &mut m.untyped }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "histogram", + |m: &Metric| { &m.histogram }, + |m: &mut Metric| { &mut m.histogram }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "timestamp_ms", + |m: &Metric| { &m.timestamp_ms }, + |m: &mut Metric| { &mut m.timestamp_ms }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "Metric", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static Metric { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Metric, + }; + unsafe { + instance.get(Metric::new) + } + } +} + +impl ::protobuf::Clear for Metric { + fn clear(&mut self) { + self.clear_label(); + self.clear_gauge(); + self.clear_counter(); + self.clear_summary(); + self.clear_untyped(); + self.clear_histogram(); + self.clear_timestamp_ms(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for Metric { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for Metric { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct MetricFamily { + // message fields + name: ::protobuf::SingularField<::std::string::String>, + help: ::protobuf::SingularField<::std::string::String>, + field_type: ::std::option::Option, + metric: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +impl MetricFamily { + pub fn new() -> MetricFamily { + ::std::default::Default::default() + } + + // optional string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + pub fn has_name(&self) -> bool { + self.name.is_some() + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + if self.name.is_none() { + self.name.set_default(); + } + self.name.as_mut().unwrap() + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + self.name.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + match self.name.as_ref() { + Some(v) => &v, + None => "", + } + } + + // optional string help = 2; + + pub fn clear_help(&mut self) { + self.help.clear(); + } + + pub fn has_help(&self) -> bool { + self.help.is_some() + } + + // Param is passed by value, moved + pub fn set_help(&mut self, v: ::std::string::String) { + self.help = ::protobuf::SingularField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_help(&mut self) -> &mut ::std::string::String { + if self.help.is_none() { + self.help.set_default(); + } + self.help.as_mut().unwrap() + } + + // Take field + pub fn take_help(&mut self) -> ::std::string::String { + self.help.take().unwrap_or_else(|| ::std::string::String::new()) + } + + pub fn get_help(&self) -> &str { + match self.help.as_ref() { + Some(v) => &v, + None => "", + } + } + + // optional .io.prometheus.client.MetricType type = 3; + + pub fn clear_field_type(&mut self) { + self.field_type = ::std::option::Option::None; + } + + pub fn has_field_type(&self) -> bool { + self.field_type.is_some() + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: MetricType) { + self.field_type = ::std::option::Option::Some(v); + } + + pub fn get_field_type(&self) -> MetricType { + self.field_type.unwrap_or(MetricType::COUNTER) + } + + // repeated .io.prometheus.client.Metric metric = 4; + + pub fn clear_metric(&mut self) { + self.metric.clear(); + } + + // Param is passed by value, moved + pub fn set_metric(&mut self, v: ::protobuf::RepeatedField) { + self.metric = v; + } + + // Mutable pointer to the field. + pub fn mut_metric(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.metric + } + + // Take field + pub fn take_metric(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.metric, ::protobuf::RepeatedField::new()) + } + + pub fn get_metric(&self) -> &[Metric] { + &self.metric + } +} + +impl ::protobuf::Message for MetricFamily { + fn is_initialized(&self) -> bool { + for v in &self.metric { + if !v.is_initialized() { + return false; + } + }; + 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 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_string_into(wire_type, is, &mut self.help)?; + }, + 3 => { + ::protobuf::rt::read_proto2_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 3, &mut self.unknown_fields)? + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.metric)?; + }, + _ => { + ::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(ref v) = self.name.as_ref() { + my_size += ::protobuf::rt::string_size(1, &v); + } + if let Some(ref v) = self.help.as_ref() { + my_size += ::protobuf::rt::string_size(2, &v); + } + if let Some(v) = self.field_type { + my_size += ::protobuf::rt::enum_size(3, v); + } + for value in &self.metric { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + 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(ref v) = self.name.as_ref() { + os.write_string(1, &v)?; + } + if let Some(ref v) = self.help.as_ref() { + os.write_string(2, &v)?; + } + if let Some(v) = self.field_type { + os.write_enum(3, v.value())?; + } + for v in &self.metric { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + 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 as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + Self::descriptor_static() + } + + fn new() -> MetricFamily { + MetricFamily::new() + } + + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + |m: &MetricFamily| { &m.name }, + |m: &mut MetricFamily| { &mut m.name }, + )); + fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "help", + |m: &MetricFamily| { &m.help }, + |m: &mut MetricFamily| { &mut m.help }, + )); + fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "type", + |m: &MetricFamily| { &m.field_type }, + |m: &mut MetricFamily| { &mut m.field_type }, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "metric", + |m: &MetricFamily| { &m.metric }, + |m: &mut MetricFamily| { &mut m.metric }, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "MetricFamily", + fields, + file_descriptor_proto() + ) + }) + } + } + + fn default_instance() -> &'static MetricFamily { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MetricFamily, + }; + unsafe { + instance.get(MetricFamily::new) + } + } +} + +impl ::protobuf::Clear for MetricFamily { + fn clear(&mut self) { + self.clear_name(); + self.clear_help(); + self.clear_field_type(); + self.clear_metric(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for MetricFamily { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for MetricFamily { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum MetricType { + COUNTER = 0, + GAUGE = 1, + SUMMARY = 2, + UNTYPED = 3, + HISTOGRAM = 4, +} + +impl ::protobuf::ProtobufEnum for MetricType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(MetricType::COUNTER), + 1 => ::std::option::Option::Some(MetricType::GAUGE), + 2 => ::std::option::Option::Some(MetricType::SUMMARY), + 3 => ::std::option::Option::Some(MetricType::UNTYPED), + 4 => ::std::option::Option::Some(MetricType::HISTOGRAM), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [MetricType] = &[ + MetricType::COUNTER, + MetricType::GAUGE, + MetricType::SUMMARY, + MetricType::UNTYPED, + MetricType::HISTOGRAM, + ]; + values + } + + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("MetricType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for MetricType { +} + +impl ::protobuf::reflect::ProtobufValue for MetricType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\rmetrics.proto\x12\x14io.prometheus.client\"5\n\tLabelPair\x12\x12\n\ + \x04name\x18\x01\x20\x01(\tR\x04name\x12\x14\n\x05value\x18\x02\x20\x01(\ + \tR\x05value\"\x1d\n\x05Gauge\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\ + \x05value\"\x1f\n\x07Counter\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\ + \x05value\"<\n\x08Quantile\x12\x1a\n\x08quantile\x18\x01\x20\x01(\x01R\ + \x08quantile\x12\x14\n\x05value\x18\x02\x20\x01(\x01R\x05value\"\x87\x01\ + \n\x07Summary\x12!\n\x0csample_count\x18\x01\x20\x01(\x04R\x0bsampleCoun\ + t\x12\x1d\n\nsample_sum\x18\x02\x20\x01(\x01R\tsampleSum\x12:\n\x08quant\ + ile\x18\x03\x20\x03(\x0b2\x1e.io.prometheus.client.QuantileR\x08quantile\ + \"\x1f\n\x07Untyped\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\x05value\"\ + \x83\x01\n\tHistogram\x12!\n\x0csample_count\x18\x01\x20\x01(\x04R\x0bsa\ + mpleCount\x12\x1d\n\nsample_sum\x18\x02\x20\x01(\x01R\tsampleSum\x124\n\ + \x06bucket\x18\x03\x20\x03(\x0b2\x1c.io.prometheus.client.BucketR\x06buc\ + ket\"T\n\x06Bucket\x12)\n\x10cumulative_count\x18\x01\x20\x01(\x04R\x0fc\ + umulativeCount\x12\x1f\n\x0bupper_bound\x18\x02\x20\x01(\x01R\nupperBoun\ + d\"\xff\x02\n\x06Metric\x125\n\x05label\x18\x01\x20\x03(\x0b2\x1f.io.pro\ + metheus.client.LabelPairR\x05label\x121\n\x05gauge\x18\x02\x20\x01(\x0b2\ + \x1b.io.prometheus.client.GaugeR\x05gauge\x127\n\x07counter\x18\x03\x20\ + \x01(\x0b2\x1d.io.prometheus.client.CounterR\x07counter\x127\n\x07summar\ + y\x18\x04\x20\x01(\x0b2\x1d.io.prometheus.client.SummaryR\x07summary\x12\ + 7\n\x07untyped\x18\x05\x20\x01(\x0b2\x1d.io.prometheus.client.UntypedR\ + \x07untyped\x12=\n\thistogram\x18\x07\x20\x01(\x0b2\x1f.io.prometheus.cl\ + ient.HistogramR\thistogram\x12!\n\x0ctimestamp_ms\x18\x06\x20\x01(\x03R\ + \x0btimestampMs\"\xa2\x01\n\x0cMetricFamily\x12\x12\n\x04name\x18\x01\ + \x20\x01(\tR\x04name\x12\x12\n\x04help\x18\x02\x20\x01(\tR\x04help\x124\ + \n\x04type\x18\x03\x20\x01(\x0e2\x20.io.prometheus.client.MetricTypeR\ + \x04type\x124\n\x06metric\x18\x04\x20\x03(\x0b2\x1c.io.prometheus.client\ + .MetricR\x06metric*M\n\nMetricType\x12\x0b\n\x07COUNTER\x10\0\x12\t\n\ + \x05GAUGE\x10\x01\x12\x0b\n\x07SUMMARY\x10\x02\x12\x0b\n\x07UNTYPED\x10\ + \x03\x12\r\n\tHISTOGRAM\x10\x04B\x16\n\x14io.prometheus.client\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} From 1de43c440571de47d4b3c508494425bcbf775997 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Mon, 14 May 2018 19:11:48 +0800 Subject: [PATCH 3/9] fix code review issues --- build.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.rs b/build.rs index ad801540..ceb3bb01 100644 --- a/build.rs +++ b/build.rs @@ -6,9 +6,7 @@ fn main() { out_dir: "proto", input: &["proto/metrics.proto"], includes: &["proto"], - customize: protoc_rust::Customize { - ..Default::default() - }, - }).expect("protoc"); + ..Default::default() + }).unwrap(); } } From 99acbb34509a2fb9326fcf5f213fb88f54bf7407 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Tue, 22 May 2018 11:17:05 +0800 Subject: [PATCH 4/9] add usage for the `gen` feature --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 55a509b9..a8294093 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,16 @@ The main Structures and APIs are ported from [Go client](https://github.com/prom features = ["nightly"] ``` +### Note + +The crate has a pre-generated protobuf binding file for `protobuf` v1.6, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature after you [download](https://github.com/google/protobuf) and install the the protocol buffer compiler. + +```toml +[dependencies.prometheus] +git = "https://github.com/pingcap/rust-prometheus.git" +features = ["gen] +``` + ## Example ```rust From c8e5001440b68f4f5dd177e1c206dea53c79e664 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Tue, 22 May 2018 11:19:27 +0800 Subject: [PATCH 5/9] fix a typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a8294093..7b58997a 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The main Structures and APIs are ported from [Go client](https://github.com/prom ### Note -The crate has a pre-generated protobuf binding file for `protobuf` v1.6, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature after you [download](https://github.com/google/protobuf) and install the the protocol buffer compiler. +The crate has a pre-generated protobuf binding file for `protobuf` v1.6, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature after you [download](https://github.com/google/protobuf) and install the protocol buffer compiler. ```toml [dependencies.prometheus] From 40357d077ffac5071e828d10abd7086155b8c102 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Tue, 22 May 2018 11:20:07 +0800 Subject: [PATCH 6/9] fix typo again --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b58997a..5cdc91ec 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ The crate has a pre-generated protobuf binding file for `protobuf` v1.6, if you ```toml [dependencies.prometheus] git = "https://github.com/pingcap/rust-prometheus.git" -features = ["gen] +features = ["gen"] ``` ## Example From ea2c495b79219482ee5f0051a651a70814836e5c Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Tue, 22 May 2018 13:25:39 +0800 Subject: [PATCH 7/9] upgrade `protobuf` to 1.7 --- Cargo.toml | 4 +- README.md | 2 +- proto/metrics.rs | 606 +++++++++++++++++++++++++++++++++-------------- 3 files changed, 435 insertions(+), 177 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 782b8114..3945c786 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ name = "benches" path = "benches/benches.rs" [dependencies] -protobuf = "1.6" +protobuf = "1.7" quick-error = "0.2" clippy = {version = "^0", optional = true} fnv = "1.0" @@ -58,7 +58,7 @@ getopts = "0.2" hyper = {version = "0.9", default-features = false} [build-dependencies] -protoc-rust = "1.6" +protoc-rust = "1.7" [workspace] members = ["static-metric"] diff --git a/README.md b/README.md index 5cdc91ec..0e788be0 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The main Structures and APIs are ported from [Go client](https://github.com/prom ### Note -The crate has a pre-generated protobuf binding file for `protobuf` v1.6, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature after you [download](https://github.com/google/protobuf) and install the protocol buffer compiler. +The crate has a pre-generated protobuf binding file for `protobuf` v1.7, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature after you [download](https://github.com/google/protobuf) and install the protocol buffer compiler. ```toml [dependencies.prometheus] diff --git a/proto/metrics.rs b/proto/metrics.rs index e1a419aa..5093223a 100644 --- a/proto/metrics.rs +++ b/proto/metrics.rs @@ -1,4 +1,4 @@ -// This file is generated by rust-protobuf 1.6.0. Do not edit +// This file is generated. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,11 +31,24 @@ pub struct LabelPair { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for LabelPair {} + impl LabelPair { pub fn new() -> LabelPair { ::std::default::Default::default() } + pub fn default_instance() -> &'static LabelPair { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LabelPair, + }; + unsafe { + instance.get(LabelPair::new) + } + } + // optional string name = 1; pub fn clear_name(&mut self) { @@ -72,6 +85,14 @@ impl LabelPair { } } + fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.name + } + // optional string value = 2; pub fn clear_value(&mut self) { @@ -107,6 +128,14 @@ impl LabelPair { None => "", } } + + fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.value + } } impl ::protobuf::Message for LabelPair { @@ -181,14 +210,16 @@ impl ::protobuf::Message for LabelPair { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for LabelPair { fn new() -> LabelPair { LabelPair::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -198,13 +229,13 @@ impl ::protobuf::Message for LabelPair { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - |m: &LabelPair| { &m.name }, - |m: &mut LabelPair| { &mut m.name }, + LabelPair::get_name_for_reflect, + LabelPair::mut_name_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "value", - |m: &LabelPair| { &m.value }, - |m: &mut LabelPair| { &mut m.value }, + LabelPair::get_value_for_reflect, + LabelPair::mut_value_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "LabelPair", @@ -214,16 +245,6 @@ impl ::protobuf::Message for LabelPair { }) } } - - fn default_instance() -> &'static LabelPair { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const LabelPair, - }; - unsafe { - instance.get(LabelPair::new) - } - } } impl ::protobuf::Clear for LabelPair { @@ -255,11 +276,24 @@ pub struct Gauge { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Gauge {} + impl Gauge { pub fn new() -> Gauge { ::std::default::Default::default() } + pub fn default_instance() -> &'static Gauge { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Gauge, + }; + unsafe { + instance.get(Gauge::new) + } + } + // optional double value = 1; pub fn clear_value(&mut self) { @@ -278,6 +312,14 @@ impl Gauge { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } + + fn get_value_for_reflect(&self) -> &::std::option::Option { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.value + } } impl ::protobuf::Message for Gauge { @@ -347,14 +389,16 @@ impl ::protobuf::Message for Gauge { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Gauge { fn new() -> Gauge { Gauge::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -364,8 +408,8 @@ impl ::protobuf::Message for Gauge { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - |m: &Gauge| { &m.value }, - |m: &mut Gauge| { &mut m.value }, + Gauge::get_value_for_reflect, + Gauge::mut_value_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Gauge", @@ -375,16 +419,6 @@ impl ::protobuf::Message for Gauge { }) } } - - fn default_instance() -> &'static Gauge { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Gauge, - }; - unsafe { - instance.get(Gauge::new) - } - } } impl ::protobuf::Clear for Gauge { @@ -415,11 +449,24 @@ pub struct Counter { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Counter {} + impl Counter { pub fn new() -> Counter { ::std::default::Default::default() } + pub fn default_instance() -> &'static Counter { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Counter, + }; + unsafe { + instance.get(Counter::new) + } + } + // optional double value = 1; pub fn clear_value(&mut self) { @@ -438,6 +485,14 @@ impl Counter { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } + + fn get_value_for_reflect(&self) -> &::std::option::Option { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.value + } } impl ::protobuf::Message for Counter { @@ -507,14 +562,16 @@ impl ::protobuf::Message for Counter { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Counter { fn new() -> Counter { Counter::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -524,8 +581,8 @@ impl ::protobuf::Message for Counter { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - |m: &Counter| { &m.value }, - |m: &mut Counter| { &mut m.value }, + Counter::get_value_for_reflect, + Counter::mut_value_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Counter", @@ -535,16 +592,6 @@ impl ::protobuf::Message for Counter { }) } } - - fn default_instance() -> &'static Counter { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Counter, - }; - unsafe { - instance.get(Counter::new) - } - } } impl ::protobuf::Clear for Counter { @@ -576,11 +623,24 @@ pub struct Quantile { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Quantile {} + impl Quantile { pub fn new() -> Quantile { ::std::default::Default::default() } + pub fn default_instance() -> &'static Quantile { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Quantile, + }; + unsafe { + instance.get(Quantile::new) + } + } + // optional double quantile = 1; pub fn clear_quantile(&mut self) { @@ -600,6 +660,14 @@ impl Quantile { self.quantile.unwrap_or(0.) } + fn get_quantile_for_reflect(&self) -> &::std::option::Option { + &self.quantile + } + + fn mut_quantile_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.quantile + } + // optional double value = 2; pub fn clear_value(&mut self) { @@ -618,6 +686,14 @@ impl Quantile { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } + + fn get_value_for_reflect(&self) -> &::std::option::Option { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.value + } } impl ::protobuf::Message for Quantile { @@ -700,14 +776,16 @@ impl ::protobuf::Message for Quantile { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Quantile { fn new() -> Quantile { Quantile::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -717,13 +795,13 @@ impl ::protobuf::Message for Quantile { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "quantile", - |m: &Quantile| { &m.quantile }, - |m: &mut Quantile| { &mut m.quantile }, + Quantile::get_quantile_for_reflect, + Quantile::mut_quantile_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - |m: &Quantile| { &m.value }, - |m: &mut Quantile| { &mut m.value }, + Quantile::get_value_for_reflect, + Quantile::mut_value_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Quantile", @@ -733,16 +811,6 @@ impl ::protobuf::Message for Quantile { }) } } - - fn default_instance() -> &'static Quantile { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Quantile, - }; - unsafe { - instance.get(Quantile::new) - } - } } impl ::protobuf::Clear for Quantile { @@ -776,11 +844,24 @@ pub struct Summary { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Summary {} + impl Summary { pub fn new() -> Summary { ::std::default::Default::default() } + pub fn default_instance() -> &'static Summary { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Summary, + }; + unsafe { + instance.get(Summary::new) + } + } + // optional uint64 sample_count = 1; pub fn clear_sample_count(&mut self) { @@ -800,6 +881,14 @@ impl Summary { self.sample_count.unwrap_or(0) } + fn get_sample_count_for_reflect(&self) -> &::std::option::Option { + &self.sample_count + } + + fn mut_sample_count_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.sample_count + } + // optional double sample_sum = 2; pub fn clear_sample_sum(&mut self) { @@ -819,6 +908,14 @@ impl Summary { self.sample_sum.unwrap_or(0.) } + fn get_sample_sum_for_reflect(&self) -> &::std::option::Option { + &self.sample_sum + } + + fn mut_sample_sum_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.sample_sum + } + // repeated .io.prometheus.client.Quantile quantile = 3; pub fn clear_quantile(&mut self) { @@ -843,6 +940,14 @@ impl Summary { pub fn get_quantile(&self) -> &[Quantile] { &self.quantile } + + fn get_quantile_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.quantile + } + + fn mut_quantile_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.quantile + } } impl ::protobuf::Message for Summary { @@ -942,14 +1047,16 @@ impl ::protobuf::Message for Summary { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Summary { fn new() -> Summary { Summary::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -959,18 +1066,18 @@ impl ::protobuf::Message for Summary { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( "sample_count", - |m: &Summary| { &m.sample_count }, - |m: &mut Summary| { &mut m.sample_count }, + Summary::get_sample_count_for_reflect, + Summary::mut_sample_count_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "sample_sum", - |m: &Summary| { &m.sample_sum }, - |m: &mut Summary| { &mut m.sample_sum }, + Summary::get_sample_sum_for_reflect, + Summary::mut_sample_sum_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "quantile", - |m: &Summary| { &m.quantile }, - |m: &mut Summary| { &mut m.quantile }, + Summary::get_quantile_for_reflect, + Summary::mut_quantile_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Summary", @@ -980,16 +1087,6 @@ impl ::protobuf::Message for Summary { }) } } - - fn default_instance() -> &'static Summary { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Summary, - }; - unsafe { - instance.get(Summary::new) - } - } } impl ::protobuf::Clear for Summary { @@ -1022,11 +1119,24 @@ pub struct Untyped { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Untyped {} + impl Untyped { pub fn new() -> Untyped { ::std::default::Default::default() } + pub fn default_instance() -> &'static Untyped { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Untyped, + }; + unsafe { + instance.get(Untyped::new) + } + } + // optional double value = 1; pub fn clear_value(&mut self) { @@ -1045,6 +1155,14 @@ impl Untyped { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } + + fn get_value_for_reflect(&self) -> &::std::option::Option { + &self.value + } + + fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.value + } } impl ::protobuf::Message for Untyped { @@ -1114,14 +1232,16 @@ impl ::protobuf::Message for Untyped { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Untyped { fn new() -> Untyped { Untyped::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1131,8 +1251,8 @@ impl ::protobuf::Message for Untyped { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - |m: &Untyped| { &m.value }, - |m: &mut Untyped| { &mut m.value }, + Untyped::get_value_for_reflect, + Untyped::mut_value_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Untyped", @@ -1142,16 +1262,6 @@ impl ::protobuf::Message for Untyped { }) } } - - fn default_instance() -> &'static Untyped { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Untyped, - }; - unsafe { - instance.get(Untyped::new) - } - } } impl ::protobuf::Clear for Untyped { @@ -1184,11 +1294,24 @@ pub struct Histogram { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Histogram {} + impl Histogram { pub fn new() -> Histogram { ::std::default::Default::default() } + pub fn default_instance() -> &'static Histogram { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Histogram, + }; + unsafe { + instance.get(Histogram::new) + } + } + // optional uint64 sample_count = 1; pub fn clear_sample_count(&mut self) { @@ -1208,6 +1331,14 @@ impl Histogram { self.sample_count.unwrap_or(0) } + fn get_sample_count_for_reflect(&self) -> &::std::option::Option { + &self.sample_count + } + + fn mut_sample_count_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.sample_count + } + // optional double sample_sum = 2; pub fn clear_sample_sum(&mut self) { @@ -1227,6 +1358,14 @@ impl Histogram { self.sample_sum.unwrap_or(0.) } + fn get_sample_sum_for_reflect(&self) -> &::std::option::Option { + &self.sample_sum + } + + fn mut_sample_sum_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.sample_sum + } + // repeated .io.prometheus.client.Bucket bucket = 3; pub fn clear_bucket(&mut self) { @@ -1251,6 +1390,14 @@ impl Histogram { pub fn get_bucket(&self) -> &[Bucket] { &self.bucket } + + fn get_bucket_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.bucket + } + + fn mut_bucket_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.bucket + } } impl ::protobuf::Message for Histogram { @@ -1350,14 +1497,16 @@ impl ::protobuf::Message for Histogram { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Histogram { fn new() -> Histogram { Histogram::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1367,18 +1516,18 @@ impl ::protobuf::Message for Histogram { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( "sample_count", - |m: &Histogram| { &m.sample_count }, - |m: &mut Histogram| { &mut m.sample_count }, + Histogram::get_sample_count_for_reflect, + Histogram::mut_sample_count_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "sample_sum", - |m: &Histogram| { &m.sample_sum }, - |m: &mut Histogram| { &mut m.sample_sum }, + Histogram::get_sample_sum_for_reflect, + Histogram::mut_sample_sum_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "bucket", - |m: &Histogram| { &m.bucket }, - |m: &mut Histogram| { &mut m.bucket }, + Histogram::get_bucket_for_reflect, + Histogram::mut_bucket_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Histogram", @@ -1388,16 +1537,6 @@ impl ::protobuf::Message for Histogram { }) } } - - fn default_instance() -> &'static Histogram { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Histogram, - }; - unsafe { - instance.get(Histogram::new) - } - } } impl ::protobuf::Clear for Histogram { @@ -1431,11 +1570,24 @@ pub struct Bucket { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Bucket {} + impl Bucket { pub fn new() -> Bucket { ::std::default::Default::default() } + pub fn default_instance() -> &'static Bucket { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Bucket, + }; + unsafe { + instance.get(Bucket::new) + } + } + // optional uint64 cumulative_count = 1; pub fn clear_cumulative_count(&mut self) { @@ -1455,6 +1607,14 @@ impl Bucket { self.cumulative_count.unwrap_or(0) } + fn get_cumulative_count_for_reflect(&self) -> &::std::option::Option { + &self.cumulative_count + } + + fn mut_cumulative_count_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.cumulative_count + } + // optional double upper_bound = 2; pub fn clear_upper_bound(&mut self) { @@ -1473,6 +1633,14 @@ impl Bucket { pub fn get_upper_bound(&self) -> f64 { self.upper_bound.unwrap_or(0.) } + + fn get_upper_bound_for_reflect(&self) -> &::std::option::Option { + &self.upper_bound + } + + fn mut_upper_bound_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.upper_bound + } } impl ::protobuf::Message for Bucket { @@ -1555,14 +1723,16 @@ impl ::protobuf::Message for Bucket { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Bucket { fn new() -> Bucket { Bucket::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1572,13 +1742,13 @@ impl ::protobuf::Message for Bucket { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( "cumulative_count", - |m: &Bucket| { &m.cumulative_count }, - |m: &mut Bucket| { &mut m.cumulative_count }, + Bucket::get_cumulative_count_for_reflect, + Bucket::mut_cumulative_count_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "upper_bound", - |m: &Bucket| { &m.upper_bound }, - |m: &mut Bucket| { &mut m.upper_bound }, + Bucket::get_upper_bound_for_reflect, + Bucket::mut_upper_bound_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Bucket", @@ -1588,16 +1758,6 @@ impl ::protobuf::Message for Bucket { }) } } - - fn default_instance() -> &'static Bucket { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Bucket, - }; - unsafe { - instance.get(Bucket::new) - } - } } impl ::protobuf::Clear for Bucket { @@ -1635,11 +1795,24 @@ pub struct Metric { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for Metric {} + impl Metric { pub fn new() -> Metric { ::std::default::Default::default() } + pub fn default_instance() -> &'static Metric { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Metric, + }; + unsafe { + instance.get(Metric::new) + } + } + // repeated .io.prometheus.client.LabelPair label = 1; pub fn clear_label(&mut self) { @@ -1665,6 +1838,14 @@ impl Metric { &self.label } + fn get_label_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.label + } + + fn mut_label_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.label + } + // optional .io.prometheus.client.Gauge gauge = 2; pub fn clear_gauge(&mut self) { @@ -1698,6 +1879,14 @@ impl Metric { self.gauge.as_ref().unwrap_or_else(|| Gauge::default_instance()) } + fn get_gauge_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.gauge + } + + fn mut_gauge_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.gauge + } + // optional .io.prometheus.client.Counter counter = 3; pub fn clear_counter(&mut self) { @@ -1731,6 +1920,14 @@ impl Metric { self.counter.as_ref().unwrap_or_else(|| Counter::default_instance()) } + fn get_counter_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.counter + } + + fn mut_counter_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.counter + } + // optional .io.prometheus.client.Summary summary = 4; pub fn clear_summary(&mut self) { @@ -1764,6 +1961,14 @@ impl Metric { self.summary.as_ref().unwrap_or_else(|| Summary::default_instance()) } + fn get_summary_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.summary + } + + fn mut_summary_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.summary + } + // optional .io.prometheus.client.Untyped untyped = 5; pub fn clear_untyped(&mut self) { @@ -1797,6 +2002,14 @@ impl Metric { self.untyped.as_ref().unwrap_or_else(|| Untyped::default_instance()) } + fn get_untyped_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.untyped + } + + fn mut_untyped_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.untyped + } + // optional .io.prometheus.client.Histogram histogram = 7; pub fn clear_histogram(&mut self) { @@ -1830,6 +2043,14 @@ impl Metric { self.histogram.as_ref().unwrap_or_else(|| Histogram::default_instance()) } + fn get_histogram_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.histogram + } + + fn mut_histogram_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.histogram + } + // optional int64 timestamp_ms = 6; pub fn clear_timestamp_ms(&mut self) { @@ -1848,6 +2069,14 @@ impl Metric { pub fn get_timestamp_ms(&self) -> i64 { self.timestamp_ms.unwrap_or(0) } + + fn get_timestamp_ms_for_reflect(&self) -> &::std::option::Option { + &self.timestamp_ms + } + + fn mut_timestamp_ms_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.timestamp_ms + } } impl ::protobuf::Message for Metric { @@ -2019,14 +2248,16 @@ impl ::protobuf::Message for Metric { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for Metric { fn new() -> Metric { Metric::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -2036,38 +2267,38 @@ impl ::protobuf::Message for Metric { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "label", - |m: &Metric| { &m.label }, - |m: &mut Metric| { &mut m.label }, + Metric::get_label_for_reflect, + Metric::mut_label_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "gauge", - |m: &Metric| { &m.gauge }, - |m: &mut Metric| { &mut m.gauge }, + Metric::get_gauge_for_reflect, + Metric::mut_gauge_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "counter", - |m: &Metric| { &m.counter }, - |m: &mut Metric| { &mut m.counter }, + Metric::get_counter_for_reflect, + Metric::mut_counter_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "summary", - |m: &Metric| { &m.summary }, - |m: &mut Metric| { &mut m.summary }, + Metric::get_summary_for_reflect, + Metric::mut_summary_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "untyped", - |m: &Metric| { &m.untyped }, - |m: &mut Metric| { &mut m.untyped }, + Metric::get_untyped_for_reflect, + Metric::mut_untyped_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "histogram", - |m: &Metric| { &m.histogram }, - |m: &mut Metric| { &mut m.histogram }, + Metric::get_histogram_for_reflect, + Metric::mut_histogram_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( "timestamp_ms", - |m: &Metric| { &m.timestamp_ms }, - |m: &mut Metric| { &mut m.timestamp_ms }, + Metric::get_timestamp_ms_for_reflect, + Metric::mut_timestamp_ms_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "Metric", @@ -2077,16 +2308,6 @@ impl ::protobuf::Message for Metric { }) } } - - fn default_instance() -> &'static Metric { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Metric, - }; - unsafe { - instance.get(Metric::new) - } - } } impl ::protobuf::Clear for Metric { @@ -2126,11 +2347,24 @@ pub struct MetricFamily { cached_size: ::protobuf::CachedSize, } +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for MetricFamily {} + impl MetricFamily { pub fn new() -> MetricFamily { ::std::default::Default::default() } + pub fn default_instance() -> &'static MetricFamily { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MetricFamily, + }; + unsafe { + instance.get(MetricFamily::new) + } + } + // optional string name = 1; pub fn clear_name(&mut self) { @@ -2167,6 +2401,14 @@ impl MetricFamily { } } + fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.name + } + // optional string help = 2; pub fn clear_help(&mut self) { @@ -2203,6 +2445,14 @@ impl MetricFamily { } } + fn get_help_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { + &self.help + } + + fn mut_help_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { + &mut self.help + } + // optional .io.prometheus.client.MetricType type = 3; pub fn clear_field_type(&mut self) { @@ -2222,6 +2472,14 @@ impl MetricFamily { self.field_type.unwrap_or(MetricType::COUNTER) } + fn get_field_type_for_reflect(&self) -> &::std::option::Option { + &self.field_type + } + + fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option { + &mut self.field_type + } + // repeated .io.prometheus.client.Metric metric = 4; pub fn clear_metric(&mut self) { @@ -2246,6 +2504,14 @@ impl MetricFamily { pub fn get_metric(&self) -> &[Metric] { &self.metric } + + fn get_metric_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.metric + } + + fn mut_metric_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.metric + } } impl ::protobuf::Message for MetricFamily { @@ -2346,14 +2612,16 @@ impl ::protobuf::Message for MetricFamily { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - Self::descriptor_static() + ::protobuf::MessageStatic::descriptor_static(None::) } +} +impl ::protobuf::MessageStatic for MetricFamily { fn new() -> MetricFamily { MetricFamily::new() } - fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -2363,23 +2631,23 @@ impl ::protobuf::Message for MetricFamily { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - |m: &MetricFamily| { &m.name }, - |m: &mut MetricFamily| { &mut m.name }, + MetricFamily::get_name_for_reflect, + MetricFamily::mut_name_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "help", - |m: &MetricFamily| { &m.help }, - |m: &mut MetricFamily| { &mut m.help }, + MetricFamily::get_help_for_reflect, + MetricFamily::mut_help_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", - |m: &MetricFamily| { &m.field_type }, - |m: &mut MetricFamily| { &mut m.field_type }, + MetricFamily::get_field_type_for_reflect, + MetricFamily::mut_field_type_for_reflect, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "metric", - |m: &MetricFamily| { &m.metric }, - |m: &mut MetricFamily| { &mut m.metric }, + MetricFamily::get_metric_for_reflect, + MetricFamily::mut_metric_for_reflect, )); ::protobuf::reflect::MessageDescriptor::new::( "MetricFamily", @@ -2389,16 +2657,6 @@ impl ::protobuf::Message for MetricFamily { }) } } - - fn default_instance() -> &'static MetricFamily { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MetricFamily, - }; - unsafe { - instance.get(MetricFamily::new) - } - } } impl ::protobuf::Clear for MetricFamily { @@ -2459,7 +2717,7 @@ impl ::protobuf::ProtobufEnum for MetricType { values } - fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, From 65a01b764702f1d4c980e3bc5dfdd212fedc1152 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Tue, 22 May 2018 14:30:47 +0800 Subject: [PATCH 8/9] upgrade `protobuf` to v2.0 and use pure rust generator --- Cargo.toml | 4 +- README.md | 2 +- build.rs | 4 +- proto/metrics.rs | 666 +++++++++++++++-------------------------------- 4 files changed, 209 insertions(+), 467 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3945c786..bcc731ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ name = "benches" path = "benches/benches.rs" [dependencies] -protobuf = "1.7" +protobuf = "2.0" quick-error = "0.2" clippy = {version = "^0", optional = true} fnv = "1.0" @@ -58,7 +58,7 @@ getopts = "0.2" hyper = {version = "0.9", default-features = false} [build-dependencies] -protoc-rust = "1.7" +protobuf-codegen-pure = "2.0" [workspace] members = ["static-metric"] diff --git a/README.md b/README.md index 0e788be0..3ebdc819 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ The main Structures and APIs are ported from [Go client](https://github.com/prom ### Note -The crate has a pre-generated protobuf binding file for `protobuf` v1.7, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature after you [download](https://github.com/google/protobuf) and install the protocol buffer compiler. +The crate has a pre-generated protobuf binding file for `protobuf` v2.0, if you need use the latest version of `protobuf`, you can generate the binding file on building with the `gen` feature. ```toml [dependencies.prometheus] diff --git a/build.rs b/build.rs index ceb3bb01..57d84710 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,8 @@ -extern crate protoc_rust; +extern crate protobuf_codegen_pure; fn main() { if cfg!(feature = "gen") { - protoc_rust::run(protoc_rust::Args { + protobuf_codegen_pure::run(protobuf_codegen_pure::Args { out_dir: "proto", input: &["proto/metrics.proto"], includes: &["proto"], diff --git a/proto/metrics.rs b/proto/metrics.rs index 5093223a..35533ce0 100644 --- a/proto/metrics.rs +++ b/proto/metrics.rs @@ -1,4 +1,4 @@ -// This file is generated. Do not edit +// This file is generated by rust-protobuf 2.0.0. Do not edit // @generated // https://github.com/Manishearth/rust-clippy/issues/702 @@ -31,24 +31,11 @@ pub struct LabelPair { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for LabelPair {} - impl LabelPair { pub fn new() -> LabelPair { ::std::default::Default::default() } - pub fn default_instance() -> &'static LabelPair { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const LabelPair, - }; - unsafe { - instance.get(LabelPair::new) - } - } - // optional string name = 1; pub fn clear_name(&mut self) { @@ -85,14 +72,6 @@ impl LabelPair { } } - fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.name - } - // optional string value = 2; pub fn clear_value(&mut self) { @@ -128,14 +107,6 @@ impl LabelPair { None => "", } } - - fn get_value_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.value - } } impl ::protobuf::Message for LabelPair { @@ -210,16 +181,14 @@ impl ::protobuf::Message for LabelPair { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for LabelPair { fn new() -> LabelPair { LabelPair::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -229,13 +198,13 @@ impl ::protobuf::MessageStatic for LabelPair { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - LabelPair::get_name_for_reflect, - LabelPair::mut_name_for_reflect, + |m: &LabelPair| { &m.name }, + |m: &mut LabelPair| { &mut m.name }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "value", - LabelPair::get_value_for_reflect, - LabelPair::mut_value_for_reflect, + |m: &LabelPair| { &m.value }, + |m: &mut LabelPair| { &mut m.value }, )); ::protobuf::reflect::MessageDescriptor::new::( "LabelPair", @@ -245,6 +214,16 @@ impl ::protobuf::MessageStatic for LabelPair { }) } } + + fn default_instance() -> &'static LabelPair { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const LabelPair, + }; + unsafe { + instance.get(LabelPair::new) + } + } } impl ::protobuf::Clear for LabelPair { @@ -276,24 +255,11 @@ pub struct Gauge { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Gauge {} - impl Gauge { pub fn new() -> Gauge { ::std::default::Default::default() } - pub fn default_instance() -> &'static Gauge { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Gauge, - }; - unsafe { - instance.get(Gauge::new) - } - } - // optional double value = 1; pub fn clear_value(&mut self) { @@ -312,14 +278,6 @@ impl Gauge { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } } impl ::protobuf::Message for Gauge { @@ -389,16 +347,14 @@ impl ::protobuf::Message for Gauge { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Gauge { fn new() -> Gauge { Gauge::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -408,8 +364,8 @@ impl ::protobuf::MessageStatic for Gauge { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - Gauge::get_value_for_reflect, - Gauge::mut_value_for_reflect, + |m: &Gauge| { &m.value }, + |m: &mut Gauge| { &mut m.value }, )); ::protobuf::reflect::MessageDescriptor::new::( "Gauge", @@ -419,6 +375,16 @@ impl ::protobuf::MessageStatic for Gauge { }) } } + + fn default_instance() -> &'static Gauge { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Gauge, + }; + unsafe { + instance.get(Gauge::new) + } + } } impl ::protobuf::Clear for Gauge { @@ -449,24 +415,11 @@ pub struct Counter { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Counter {} - impl Counter { pub fn new() -> Counter { ::std::default::Default::default() } - pub fn default_instance() -> &'static Counter { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Counter, - }; - unsafe { - instance.get(Counter::new) - } - } - // optional double value = 1; pub fn clear_value(&mut self) { @@ -485,14 +438,6 @@ impl Counter { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } } impl ::protobuf::Message for Counter { @@ -562,16 +507,14 @@ impl ::protobuf::Message for Counter { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Counter { fn new() -> Counter { Counter::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -581,8 +524,8 @@ impl ::protobuf::MessageStatic for Counter { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - Counter::get_value_for_reflect, - Counter::mut_value_for_reflect, + |m: &Counter| { &m.value }, + |m: &mut Counter| { &mut m.value }, )); ::protobuf::reflect::MessageDescriptor::new::( "Counter", @@ -592,6 +535,16 @@ impl ::protobuf::MessageStatic for Counter { }) } } + + fn default_instance() -> &'static Counter { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Counter, + }; + unsafe { + instance.get(Counter::new) + } + } } impl ::protobuf::Clear for Counter { @@ -623,24 +576,11 @@ pub struct Quantile { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Quantile {} - impl Quantile { pub fn new() -> Quantile { ::std::default::Default::default() } - pub fn default_instance() -> &'static Quantile { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Quantile, - }; - unsafe { - instance.get(Quantile::new) - } - } - // optional double quantile = 1; pub fn clear_quantile(&mut self) { @@ -660,14 +600,6 @@ impl Quantile { self.quantile.unwrap_or(0.) } - fn get_quantile_for_reflect(&self) -> &::std::option::Option { - &self.quantile - } - - fn mut_quantile_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.quantile - } - // optional double value = 2; pub fn clear_value(&mut self) { @@ -686,14 +618,6 @@ impl Quantile { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } } impl ::protobuf::Message for Quantile { @@ -776,16 +700,14 @@ impl ::protobuf::Message for Quantile { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Quantile { fn new() -> Quantile { Quantile::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -795,13 +717,13 @@ impl ::protobuf::MessageStatic for Quantile { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "quantile", - Quantile::get_quantile_for_reflect, - Quantile::mut_quantile_for_reflect, + |m: &Quantile| { &m.quantile }, + |m: &mut Quantile| { &mut m.quantile }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - Quantile::get_value_for_reflect, - Quantile::mut_value_for_reflect, + |m: &Quantile| { &m.value }, + |m: &mut Quantile| { &mut m.value }, )); ::protobuf::reflect::MessageDescriptor::new::( "Quantile", @@ -811,6 +733,16 @@ impl ::protobuf::MessageStatic for Quantile { }) } } + + fn default_instance() -> &'static Quantile { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Quantile, + }; + unsafe { + instance.get(Quantile::new) + } + } } impl ::protobuf::Clear for Quantile { @@ -844,24 +776,11 @@ pub struct Summary { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Summary {} - impl Summary { pub fn new() -> Summary { ::std::default::Default::default() } - pub fn default_instance() -> &'static Summary { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Summary, - }; - unsafe { - instance.get(Summary::new) - } - } - // optional uint64 sample_count = 1; pub fn clear_sample_count(&mut self) { @@ -881,14 +800,6 @@ impl Summary { self.sample_count.unwrap_or(0) } - fn get_sample_count_for_reflect(&self) -> &::std::option::Option { - &self.sample_count - } - - fn mut_sample_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_count - } - // optional double sample_sum = 2; pub fn clear_sample_sum(&mut self) { @@ -908,14 +819,6 @@ impl Summary { self.sample_sum.unwrap_or(0.) } - fn get_sample_sum_for_reflect(&self) -> &::std::option::Option { - &self.sample_sum - } - - fn mut_sample_sum_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_sum - } - // repeated .io.prometheus.client.Quantile quantile = 3; pub fn clear_quantile(&mut self) { @@ -940,14 +843,6 @@ impl Summary { pub fn get_quantile(&self) -> &[Quantile] { &self.quantile } - - fn get_quantile_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.quantile - } - - fn mut_quantile_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.quantile - } } impl ::protobuf::Message for Summary { @@ -1047,16 +942,14 @@ impl ::protobuf::Message for Summary { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Summary { fn new() -> Summary { Summary::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1066,18 +959,18 @@ impl ::protobuf::MessageStatic for Summary { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( "sample_count", - Summary::get_sample_count_for_reflect, - Summary::mut_sample_count_for_reflect, + |m: &Summary| { &m.sample_count }, + |m: &mut Summary| { &mut m.sample_count }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "sample_sum", - Summary::get_sample_sum_for_reflect, - Summary::mut_sample_sum_for_reflect, + |m: &Summary| { &m.sample_sum }, + |m: &mut Summary| { &mut m.sample_sum }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "quantile", - Summary::get_quantile_for_reflect, - Summary::mut_quantile_for_reflect, + |m: &Summary| { &m.quantile }, + |m: &mut Summary| { &mut m.quantile }, )); ::protobuf::reflect::MessageDescriptor::new::( "Summary", @@ -1087,6 +980,16 @@ impl ::protobuf::MessageStatic for Summary { }) } } + + fn default_instance() -> &'static Summary { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Summary, + }; + unsafe { + instance.get(Summary::new) + } + } } impl ::protobuf::Clear for Summary { @@ -1119,24 +1022,11 @@ pub struct Untyped { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Untyped {} - impl Untyped { pub fn new() -> Untyped { ::std::default::Default::default() } - pub fn default_instance() -> &'static Untyped { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Untyped, - }; - unsafe { - instance.get(Untyped::new) - } - } - // optional double value = 1; pub fn clear_value(&mut self) { @@ -1155,14 +1045,6 @@ impl Untyped { pub fn get_value(&self) -> f64 { self.value.unwrap_or(0.) } - - fn get_value_for_reflect(&self) -> &::std::option::Option { - &self.value - } - - fn mut_value_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.value - } } impl ::protobuf::Message for Untyped { @@ -1232,16 +1114,14 @@ impl ::protobuf::Message for Untyped { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Untyped { fn new() -> Untyped { Untyped::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1251,8 +1131,8 @@ impl ::protobuf::MessageStatic for Untyped { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "value", - Untyped::get_value_for_reflect, - Untyped::mut_value_for_reflect, + |m: &Untyped| { &m.value }, + |m: &mut Untyped| { &mut m.value }, )); ::protobuf::reflect::MessageDescriptor::new::( "Untyped", @@ -1262,6 +1142,16 @@ impl ::protobuf::MessageStatic for Untyped { }) } } + + fn default_instance() -> &'static Untyped { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Untyped, + }; + unsafe { + instance.get(Untyped::new) + } + } } impl ::protobuf::Clear for Untyped { @@ -1294,24 +1184,11 @@ pub struct Histogram { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Histogram {} - impl Histogram { pub fn new() -> Histogram { ::std::default::Default::default() } - pub fn default_instance() -> &'static Histogram { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Histogram, - }; - unsafe { - instance.get(Histogram::new) - } - } - // optional uint64 sample_count = 1; pub fn clear_sample_count(&mut self) { @@ -1331,14 +1208,6 @@ impl Histogram { self.sample_count.unwrap_or(0) } - fn get_sample_count_for_reflect(&self) -> &::std::option::Option { - &self.sample_count - } - - fn mut_sample_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_count - } - // optional double sample_sum = 2; pub fn clear_sample_sum(&mut self) { @@ -1358,14 +1227,6 @@ impl Histogram { self.sample_sum.unwrap_or(0.) } - fn get_sample_sum_for_reflect(&self) -> &::std::option::Option { - &self.sample_sum - } - - fn mut_sample_sum_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.sample_sum - } - // repeated .io.prometheus.client.Bucket bucket = 3; pub fn clear_bucket(&mut self) { @@ -1390,14 +1251,6 @@ impl Histogram { pub fn get_bucket(&self) -> &[Bucket] { &self.bucket } - - fn get_bucket_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.bucket - } - - fn mut_bucket_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.bucket - } } impl ::protobuf::Message for Histogram { @@ -1497,16 +1350,14 @@ impl ::protobuf::Message for Histogram { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Histogram { fn new() -> Histogram { Histogram::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1516,18 +1367,18 @@ impl ::protobuf::MessageStatic for Histogram { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( "sample_count", - Histogram::get_sample_count_for_reflect, - Histogram::mut_sample_count_for_reflect, + |m: &Histogram| { &m.sample_count }, + |m: &mut Histogram| { &mut m.sample_count }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "sample_sum", - Histogram::get_sample_sum_for_reflect, - Histogram::mut_sample_sum_for_reflect, + |m: &Histogram| { &m.sample_sum }, + |m: &mut Histogram| { &mut m.sample_sum }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "bucket", - Histogram::get_bucket_for_reflect, - Histogram::mut_bucket_for_reflect, + |m: &Histogram| { &m.bucket }, + |m: &mut Histogram| { &mut m.bucket }, )); ::protobuf::reflect::MessageDescriptor::new::( "Histogram", @@ -1537,6 +1388,16 @@ impl ::protobuf::MessageStatic for Histogram { }) } } + + fn default_instance() -> &'static Histogram { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Histogram, + }; + unsafe { + instance.get(Histogram::new) + } + } } impl ::protobuf::Clear for Histogram { @@ -1570,24 +1431,11 @@ pub struct Bucket { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Bucket {} - impl Bucket { pub fn new() -> Bucket { ::std::default::Default::default() } - pub fn default_instance() -> &'static Bucket { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Bucket, - }; - unsafe { - instance.get(Bucket::new) - } - } - // optional uint64 cumulative_count = 1; pub fn clear_cumulative_count(&mut self) { @@ -1607,14 +1455,6 @@ impl Bucket { self.cumulative_count.unwrap_or(0) } - fn get_cumulative_count_for_reflect(&self) -> &::std::option::Option { - &self.cumulative_count - } - - fn mut_cumulative_count_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.cumulative_count - } - // optional double upper_bound = 2; pub fn clear_upper_bound(&mut self) { @@ -1633,14 +1473,6 @@ impl Bucket { pub fn get_upper_bound(&self) -> f64 { self.upper_bound.unwrap_or(0.) } - - fn get_upper_bound_for_reflect(&self) -> &::std::option::Option { - &self.upper_bound - } - - fn mut_upper_bound_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.upper_bound - } } impl ::protobuf::Message for Bucket { @@ -1723,16 +1555,14 @@ impl ::protobuf::Message for Bucket { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Bucket { fn new() -> Bucket { Bucket::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -1742,13 +1572,13 @@ impl ::protobuf::MessageStatic for Bucket { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( "cumulative_count", - Bucket::get_cumulative_count_for_reflect, - Bucket::mut_cumulative_count_for_reflect, + |m: &Bucket| { &m.cumulative_count }, + |m: &mut Bucket| { &mut m.cumulative_count }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( "upper_bound", - Bucket::get_upper_bound_for_reflect, - Bucket::mut_upper_bound_for_reflect, + |m: &Bucket| { &m.upper_bound }, + |m: &mut Bucket| { &mut m.upper_bound }, )); ::protobuf::reflect::MessageDescriptor::new::( "Bucket", @@ -1758,6 +1588,16 @@ impl ::protobuf::MessageStatic for Bucket { }) } } + + fn default_instance() -> &'static Bucket { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Bucket, + }; + unsafe { + instance.get(Bucket::new) + } + } } impl ::protobuf::Clear for Bucket { @@ -1795,24 +1635,11 @@ pub struct Metric { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for Metric {} - impl Metric { pub fn new() -> Metric { ::std::default::Default::default() } - pub fn default_instance() -> &'static Metric { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const Metric, - }; - unsafe { - instance.get(Metric::new) - } - } - // repeated .io.prometheus.client.LabelPair label = 1; pub fn clear_label(&mut self) { @@ -1838,14 +1665,6 @@ impl Metric { &self.label } - fn get_label_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.label - } - - fn mut_label_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.label - } - // optional .io.prometheus.client.Gauge gauge = 2; pub fn clear_gauge(&mut self) { @@ -1879,14 +1698,6 @@ impl Metric { self.gauge.as_ref().unwrap_or_else(|| Gauge::default_instance()) } - fn get_gauge_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.gauge - } - - fn mut_gauge_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.gauge - } - // optional .io.prometheus.client.Counter counter = 3; pub fn clear_counter(&mut self) { @@ -1920,14 +1731,6 @@ impl Metric { self.counter.as_ref().unwrap_or_else(|| Counter::default_instance()) } - fn get_counter_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.counter - } - - fn mut_counter_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.counter - } - // optional .io.prometheus.client.Summary summary = 4; pub fn clear_summary(&mut self) { @@ -1961,14 +1764,6 @@ impl Metric { self.summary.as_ref().unwrap_or_else(|| Summary::default_instance()) } - fn get_summary_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.summary - } - - fn mut_summary_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.summary - } - // optional .io.prometheus.client.Untyped untyped = 5; pub fn clear_untyped(&mut self) { @@ -2002,14 +1797,6 @@ impl Metric { self.untyped.as_ref().unwrap_or_else(|| Untyped::default_instance()) } - fn get_untyped_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.untyped - } - - fn mut_untyped_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.untyped - } - // optional .io.prometheus.client.Histogram histogram = 7; pub fn clear_histogram(&mut self) { @@ -2043,14 +1830,6 @@ impl Metric { self.histogram.as_ref().unwrap_or_else(|| Histogram::default_instance()) } - fn get_histogram_for_reflect(&self) -> &::protobuf::SingularPtrField { - &self.histogram - } - - fn mut_histogram_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { - &mut self.histogram - } - // optional int64 timestamp_ms = 6; pub fn clear_timestamp_ms(&mut self) { @@ -2069,14 +1848,6 @@ impl Metric { pub fn get_timestamp_ms(&self) -> i64 { self.timestamp_ms.unwrap_or(0) } - - fn get_timestamp_ms_for_reflect(&self) -> &::std::option::Option { - &self.timestamp_ms - } - - fn mut_timestamp_ms_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.timestamp_ms - } } impl ::protobuf::Message for Metric { @@ -2248,16 +2019,14 @@ impl ::protobuf::Message for Metric { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for Metric { fn new() -> Metric { Metric::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -2267,38 +2036,38 @@ impl ::protobuf::MessageStatic for Metric { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "label", - Metric::get_label_for_reflect, - Metric::mut_label_for_reflect, + |m: &Metric| { &m.label }, + |m: &mut Metric| { &mut m.label }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "gauge", - Metric::get_gauge_for_reflect, - Metric::mut_gauge_for_reflect, + |m: &Metric| { &m.gauge }, + |m: &mut Metric| { &mut m.gauge }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "counter", - Metric::get_counter_for_reflect, - Metric::mut_counter_for_reflect, + |m: &Metric| { &m.counter }, + |m: &mut Metric| { &mut m.counter }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "summary", - Metric::get_summary_for_reflect, - Metric::mut_summary_for_reflect, + |m: &Metric| { &m.summary }, + |m: &mut Metric| { &mut m.summary }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "untyped", - Metric::get_untyped_for_reflect, - Metric::mut_untyped_for_reflect, + |m: &Metric| { &m.untyped }, + |m: &mut Metric| { &mut m.untyped }, )); fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "histogram", - Metric::get_histogram_for_reflect, - Metric::mut_histogram_for_reflect, + |m: &Metric| { &m.histogram }, + |m: &mut Metric| { &mut m.histogram }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( "timestamp_ms", - Metric::get_timestamp_ms_for_reflect, - Metric::mut_timestamp_ms_for_reflect, + |m: &Metric| { &m.timestamp_ms }, + |m: &mut Metric| { &mut m.timestamp_ms }, )); ::protobuf::reflect::MessageDescriptor::new::( "Metric", @@ -2308,6 +2077,16 @@ impl ::protobuf::MessageStatic for Metric { }) } } + + fn default_instance() -> &'static Metric { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const Metric, + }; + unsafe { + instance.get(Metric::new) + } + } } impl ::protobuf::Clear for Metric { @@ -2347,24 +2126,11 @@ pub struct MetricFamily { cached_size: ::protobuf::CachedSize, } -// see codegen.rs for the explanation why impl Sync explicitly -unsafe impl ::std::marker::Sync for MetricFamily {} - impl MetricFamily { pub fn new() -> MetricFamily { ::std::default::Default::default() } - pub fn default_instance() -> &'static MetricFamily { - static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { - lock: ::protobuf::lazy::ONCE_INIT, - ptr: 0 as *const MetricFamily, - }; - unsafe { - instance.get(MetricFamily::new) - } - } - // optional string name = 1; pub fn clear_name(&mut self) { @@ -2401,14 +2167,6 @@ impl MetricFamily { } } - fn get_name_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.name - } - - fn mut_name_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.name - } - // optional string help = 2; pub fn clear_help(&mut self) { @@ -2445,14 +2203,6 @@ impl MetricFamily { } } - fn get_help_for_reflect(&self) -> &::protobuf::SingularField<::std::string::String> { - &self.help - } - - fn mut_help_for_reflect(&mut self) -> &mut ::protobuf::SingularField<::std::string::String> { - &mut self.help - } - // optional .io.prometheus.client.MetricType type = 3; pub fn clear_field_type(&mut self) { @@ -2472,14 +2222,6 @@ impl MetricFamily { self.field_type.unwrap_or(MetricType::COUNTER) } - fn get_field_type_for_reflect(&self) -> &::std::option::Option { - &self.field_type - } - - fn mut_field_type_for_reflect(&mut self) -> &mut ::std::option::Option { - &mut self.field_type - } - // repeated .io.prometheus.client.Metric metric = 4; pub fn clear_metric(&mut self) { @@ -2504,14 +2246,6 @@ impl MetricFamily { pub fn get_metric(&self) -> &[Metric] { &self.metric } - - fn get_metric_for_reflect(&self) -> &::protobuf::RepeatedField { - &self.metric - } - - fn mut_metric_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { - &mut self.metric - } } impl ::protobuf::Message for MetricFamily { @@ -2612,16 +2346,14 @@ impl ::protobuf::Message for MetricFamily { } fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { - ::protobuf::MessageStatic::descriptor_static(None::) + Self::descriptor_static() } -} -impl ::protobuf::MessageStatic for MetricFamily { fn new() -> MetricFamily { MetricFamily::new() } - fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, @@ -2631,23 +2363,23 @@ impl ::protobuf::MessageStatic for MetricFamily { let mut fields = ::std::vec::Vec::new(); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "name", - MetricFamily::get_name_for_reflect, - MetricFamily::mut_name_for_reflect, + |m: &MetricFamily| { &m.name }, + |m: &mut MetricFamily| { &mut m.name }, )); fields.push(::protobuf::reflect::accessor::make_singular_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( "help", - MetricFamily::get_help_for_reflect, - MetricFamily::mut_help_for_reflect, + |m: &MetricFamily| { &m.help }, + |m: &mut MetricFamily| { &mut m.help }, )); fields.push(::protobuf::reflect::accessor::make_option_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( "type", - MetricFamily::get_field_type_for_reflect, - MetricFamily::mut_field_type_for_reflect, + |m: &MetricFamily| { &m.field_type }, + |m: &mut MetricFamily| { &mut m.field_type }, )); fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( "metric", - MetricFamily::get_metric_for_reflect, - MetricFamily::mut_metric_for_reflect, + |m: &MetricFamily| { &m.metric }, + |m: &mut MetricFamily| { &mut m.metric }, )); ::protobuf::reflect::MessageDescriptor::new::( "MetricFamily", @@ -2657,6 +2389,16 @@ impl ::protobuf::MessageStatic for MetricFamily { }) } } + + fn default_instance() -> &'static MetricFamily { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const MetricFamily, + }; + unsafe { + instance.get(MetricFamily::new) + } + } } impl ::protobuf::Clear for MetricFamily { @@ -2717,7 +2459,7 @@ impl ::protobuf::ProtobufEnum for MetricType { values } - fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { lock: ::protobuf::lazy::ONCE_INIT, ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, @@ -2740,36 +2482,36 @@ impl ::protobuf::reflect::ProtobufValue for MetricType { } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\rmetrics.proto\x12\x14io.prometheus.client\"5\n\tLabelPair\x12\x12\n\ - \x04name\x18\x01\x20\x01(\tR\x04name\x12\x14\n\x05value\x18\x02\x20\x01(\ - \tR\x05value\"\x1d\n\x05Gauge\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\ - \x05value\"\x1f\n\x07Counter\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\ - \x05value\"<\n\x08Quantile\x12\x1a\n\x08quantile\x18\x01\x20\x01(\x01R\ - \x08quantile\x12\x14\n\x05value\x18\x02\x20\x01(\x01R\x05value\"\x87\x01\ - \n\x07Summary\x12!\n\x0csample_count\x18\x01\x20\x01(\x04R\x0bsampleCoun\ - t\x12\x1d\n\nsample_sum\x18\x02\x20\x01(\x01R\tsampleSum\x12:\n\x08quant\ - ile\x18\x03\x20\x03(\x0b2\x1e.io.prometheus.client.QuantileR\x08quantile\ - \"\x1f\n\x07Untyped\x12\x14\n\x05value\x18\x01\x20\x01(\x01R\x05value\"\ - \x83\x01\n\tHistogram\x12!\n\x0csample_count\x18\x01\x20\x01(\x04R\x0bsa\ - mpleCount\x12\x1d\n\nsample_sum\x18\x02\x20\x01(\x01R\tsampleSum\x124\n\ - \x06bucket\x18\x03\x20\x03(\x0b2\x1c.io.prometheus.client.BucketR\x06buc\ - ket\"T\n\x06Bucket\x12)\n\x10cumulative_count\x18\x01\x20\x01(\x04R\x0fc\ - umulativeCount\x12\x1f\n\x0bupper_bound\x18\x02\x20\x01(\x01R\nupperBoun\ - d\"\xff\x02\n\x06Metric\x125\n\x05label\x18\x01\x20\x03(\x0b2\x1f.io.pro\ - metheus.client.LabelPairR\x05label\x121\n\x05gauge\x18\x02\x20\x01(\x0b2\ - \x1b.io.prometheus.client.GaugeR\x05gauge\x127\n\x07counter\x18\x03\x20\ - \x01(\x0b2\x1d.io.prometheus.client.CounterR\x07counter\x127\n\x07summar\ - y\x18\x04\x20\x01(\x0b2\x1d.io.prometheus.client.SummaryR\x07summary\x12\ - 7\n\x07untyped\x18\x05\x20\x01(\x0b2\x1d.io.prometheus.client.UntypedR\ - \x07untyped\x12=\n\thistogram\x18\x07\x20\x01(\x0b2\x1f.io.prometheus.cl\ - ient.HistogramR\thistogram\x12!\n\x0ctimestamp_ms\x18\x06\x20\x01(\x03R\ - \x0btimestampMs\"\xa2\x01\n\x0cMetricFamily\x12\x12\n\x04name\x18\x01\ - \x20\x01(\tR\x04name\x12\x12\n\x04help\x18\x02\x20\x01(\tR\x04help\x124\ - \n\x04type\x18\x03\x20\x01(\x0e2\x20.io.prometheus.client.MetricTypeR\ - \x04type\x124\n\x06metric\x18\x04\x20\x03(\x0b2\x1c.io.prometheus.client\ - .MetricR\x06metric*M\n\nMetricType\x12\x0b\n\x07COUNTER\x10\0\x12\t\n\ - \x05GAUGE\x10\x01\x12\x0b\n\x07SUMMARY\x10\x02\x12\x0b\n\x07UNTYPED\x10\ - \x03\x12\r\n\tHISTOGRAM\x10\x04B\x16\n\x14io.prometheus.client\ + \n\rmetrics.proto\x12\x14io.prometheus.client\"0\n\tLabelPair\x12\x10\n\ + \x04name\x18\x01\x20\x01(\tB\x02\x18\0\x12\x11\n\x05value\x18\x02\x20\ + \x01(\tB\x02\x18\0\"\x1a\n\x05Gauge\x12\x11\n\x05value\x18\x01\x20\x01(\ + \x01B\x02\x18\0\"\x1c\n\x07Counter\x12\x11\n\x05value\x18\x01\x20\x01(\ + \x01B\x02\x18\0\"3\n\x08Quantile\x12\x14\n\x08quantile\x18\x01\x20\x01(\ + \x01B\x02\x18\0\x12\x11\n\x05value\x18\x02\x20\x01(\x01B\x02\x18\0\"q\n\ + \x07Summary\x12\x18\n\x0csample_count\x18\x01\x20\x01(\x04B\x02\x18\0\ + \x12\x16\n\nsample_sum\x18\x02\x20\x01(\x01B\x02\x18\0\x124\n\x08quantil\ + e\x18\x03\x20\x03(\x0b2\x1e.io.prometheus.client.QuantileB\x02\x18\0\"\ + \x1c\n\x07Untyped\x12\x11\n\x05value\x18\x01\x20\x01(\x01B\x02\x18\0\"o\ + \n\tHistogram\x12\x18\n\x0csample_count\x18\x01\x20\x01(\x04B\x02\x18\0\ + \x12\x16\n\nsample_sum\x18\x02\x20\x01(\x01B\x02\x18\0\x120\n\x06bucket\ + \x18\x03\x20\x03(\x0b2\x1c.io.prometheus.client.BucketB\x02\x18\0\"?\n\ + \x06Bucket\x12\x1c\n\x10cumulative_count\x18\x01\x20\x01(\x04B\x02\x18\0\ + \x12\x17\n\x0bupper_bound\x18\x02\x20\x01(\x01B\x02\x18\0\"\xda\x02\n\ + \x06Metric\x122\n\x05label\x18\x01\x20\x03(\x0b2\x1f.io.prometheus.clien\ + t.LabelPairB\x02\x18\0\x12.\n\x05gauge\x18\x02\x20\x01(\x0b2\x1b.io.prom\ + etheus.client.GaugeB\x02\x18\0\x122\n\x07counter\x18\x03\x20\x01(\x0b2\ + \x1d.io.prometheus.client.CounterB\x02\x18\0\x122\n\x07summary\x18\x04\ + \x20\x01(\x0b2\x1d.io.prometheus.client.SummaryB\x02\x18\0\x122\n\x07unt\ + yped\x18\x05\x20\x01(\x0b2\x1d.io.prometheus.client.UntypedB\x02\x18\0\ + \x126\n\thistogram\x18\x07\x20\x01(\x0b2\x1f.io.prometheus.client.Histog\ + ramB\x02\x18\0\x12\x18\n\x0ctimestamp_ms\x18\x06\x20\x01(\x03B\x02\x18\0\ + \"\x98\x01\n\x0cMetricFamily\x12\x10\n\x04name\x18\x01\x20\x01(\tB\x02\ + \x18\0\x12\x10\n\x04help\x18\x02\x20\x01(\tB\x02\x18\0\x122\n\x04type\ + \x18\x03\x20\x01(\x0e2\x20.io.prometheus.client.MetricTypeB\x02\x18\0\ + \x120\n\x06metric\x18\x04\x20\x03(\x0b2\x1c.io.prometheus.client.MetricB\ + \x02\x18\0*Q\n\nMetricType\x12\x0b\n\x07COUNTER\x10\0\x12\t\n\x05GAUGE\ + \x10\x01\x12\x0b\n\x07SUMMARY\x10\x02\x12\x0b\n\x07UNTYPED\x10\x03\x12\r\ + \n\tHISTOGRAM\x10\x04\x1a\x02\x10\0B\0b\x06proto2\ "; static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { From c2cd3534e8f95d078937f7cc4a1cc4ba94aba1b8 Mon Sep 17 00:00:00 2001 From: Flier Lu Date: Tue, 22 May 2018 18:21:52 +0800 Subject: [PATCH 9/9] make `protobuf-codegen-pure` optional --- Cargo.toml | 4 ++-- build.rs | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bcc731ed..1c09457d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ dev = ["clippy"] nightly = ["libc", "spin/unstable"] push = ["hyper", "libc"] process = ["libc", "procinfo"] -gen = [] +gen = ["protobuf-codegen-pure"] [[bench]] name = "benches" @@ -58,7 +58,7 @@ getopts = "0.2" hyper = {version = "0.9", default-features = false} [build-dependencies] -protobuf-codegen-pure = "2.0" +protobuf-codegen-pure = {version = "2.0", optional = true} [workspace] members = ["static-metric"] diff --git a/build.rs b/build.rs index 57d84710..cd25ed8e 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,19 @@ +#[cfg(feature = "gen")] extern crate protobuf_codegen_pure; +#[cfg(feature = "gen")] +fn generate_protobuf_binding_file() { + protobuf_codegen_pure::run(protobuf_codegen_pure::Args { + out_dir: "proto", + input: &["proto/metrics.proto"], + includes: &["proto"], + ..Default::default() + }).unwrap(); +} + +#[cfg(not(feature = "gen"))] +fn generate_protobuf_binding_file() {} + fn main() { - if cfg!(feature = "gen") { - protobuf_codegen_pure::run(protobuf_codegen_pure::Args { - out_dir: "proto", - input: &["proto/metrics.proto"], - includes: &["proto"], - ..Default::default() - }).unwrap(); - } + generate_protobuf_binding_file() }