From 5efb21aa9a7569a9932d886d583adf313939f1d2 Mon Sep 17 00:00:00 2001 From: Chase Wilson Date: Sat, 16 May 2020 12:54:32 -0500 Subject: [PATCH] Added macro hygiene --- proto/proto_model.rs | 686 ++++++++++++++++++++++--------------------- src/macros.rs | 44 +-- 2 files changed, 366 insertions(+), 364 deletions(-) diff --git a/proto/proto_model.rs b/proto/proto_model.rs index c67aa4af..8876eaad 100644 --- a/proto/proto_model.rs +++ b/proto/proto_model.rs @@ -1,9 +1,9 @@ -// This file is generated by rust-protobuf 2.2.5. Do not edit +// This file is generated by rust-protobuf 2.14.0. Do not edit // @generated -// https://github.com/Manishearth/rust-clippy/issues/702 +// https://github.com/rust-lang/rust-clippy/issues/702 #![allow(unknown_lints)] -#![allow(clippy)] +#![allow(clippy::all)] #![cfg_attr(rustfmt, rustfmt_skip)] @@ -17,10 +17,15 @@ #![allow(unsafe_code)] #![allow(unused_imports)] #![allow(unused_results)] +//! Generated file from `proto_model.proto` use protobuf::Message as Message_imported_for_functions; use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; +/// Generated files are compatible only with the same version +/// of protobuf runtime. +// const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; + #[derive(PartialEq,Clone,Default)] pub struct LabelPair { // message fields @@ -31,6 +36,12 @@ pub struct LabelPair { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a LabelPair { + fn default() -> &'a LabelPair { + ::default_instance() + } +} + impl LabelPair { pub fn new() -> LabelPair { ::std::default::Default::default() @@ -38,6 +49,13 @@ impl LabelPair { // optional string name = 1; + + pub fn get_name(&self) -> &str { + match self.name.as_ref() { + Some(v) => &v, + None => "", + } + } pub fn clear_name(&mut self) { self.name.clear(); } @@ -65,15 +83,15 @@ impl LabelPair { self.name.take().unwrap_or_else(|| ::std::string::String::new()) } - pub fn get_name(&self) -> &str { - match self.name.as_ref() { + // optional string value = 2; + + + pub fn get_value(&self) -> &str { + match self.value.as_ref() { Some(v) => &v, None => "", } } - - // optional string value = 2; - pub fn clear_value(&mut self) { self.value.clear(); } @@ -100,13 +118,6 @@ impl LabelPair { 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 { @@ -170,13 +181,13 @@ impl ::protobuf::Message for LabelPair { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -189,10 +200,7 @@ impl ::protobuf::Message for LabelPair { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -206,7 +214,7 @@ impl ::protobuf::Message for LabelPair { |m: &LabelPair| { &m.value }, |m: &mut LabelPair| { &mut m.value }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "LabelPair", fields, file_descriptor_proto() @@ -216,10 +224,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(LabelPair::new) } @@ -228,8 +233,8 @@ impl ::protobuf::Message for LabelPair { impl ::protobuf::Clear for LabelPair { fn clear(&mut self) { - self.clear_name(); - self.clear_value(); + self.name.clear(); + self.value.clear(); self.unknown_fields.clear(); } } @@ -241,8 +246,8 @@ impl ::std::fmt::Debug for LabelPair { } impl ::protobuf::reflect::ProtobufValue for LabelPair { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -255,6 +260,12 @@ pub struct Gauge { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Gauge { + fn default() -> &'a Gauge { + ::default_instance() + } +} + impl Gauge { pub fn new() -> Gauge { ::std::default::Default::default() @@ -262,6 +273,10 @@ impl Gauge { // optional double value = 1; + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } pub fn clear_value(&mut self) { self.value = ::std::option::Option::None; } @@ -274,10 +289,6 @@ impl Gauge { 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 { @@ -336,13 +347,13 @@ impl ::protobuf::Message for Gauge { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -355,10 +366,7 @@ impl ::protobuf::Message for Gauge { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -367,7 +375,7 @@ impl ::protobuf::Message for Gauge { |m: &Gauge| { &m.value }, |m: &mut Gauge| { &mut m.value }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Gauge", fields, file_descriptor_proto() @@ -377,10 +385,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Gauge::new) } @@ -389,7 +394,7 @@ impl ::protobuf::Message for Gauge { impl ::protobuf::Clear for Gauge { fn clear(&mut self) { - self.clear_value(); + self.value = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -401,8 +406,8 @@ impl ::std::fmt::Debug for Gauge { } impl ::protobuf::reflect::ProtobufValue for Gauge { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -415,6 +420,12 @@ pub struct Counter { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Counter { + fn default() -> &'a Counter { + ::default_instance() + } +} + impl Counter { pub fn new() -> Counter { ::std::default::Default::default() @@ -422,6 +433,10 @@ impl Counter { // optional double value = 1; + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } pub fn clear_value(&mut self) { self.value = ::std::option::Option::None; } @@ -434,10 +449,6 @@ impl Counter { 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 { @@ -496,13 +507,13 @@ impl ::protobuf::Message for Counter { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -515,10 +526,7 @@ impl ::protobuf::Message for Counter { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -527,7 +535,7 @@ impl ::protobuf::Message for Counter { |m: &Counter| { &m.value }, |m: &mut Counter| { &mut m.value }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Counter", fields, file_descriptor_proto() @@ -537,10 +545,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Counter::new) } @@ -549,7 +554,7 @@ impl ::protobuf::Message for Counter { impl ::protobuf::Clear for Counter { fn clear(&mut self) { - self.clear_value(); + self.value = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -561,8 +566,8 @@ impl ::std::fmt::Debug for Counter { } impl ::protobuf::reflect::ProtobufValue for Counter { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -576,6 +581,12 @@ pub struct Quantile { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Quantile { + fn default() -> &'a Quantile { + ::default_instance() + } +} + impl Quantile { pub fn new() -> Quantile { ::std::default::Default::default() @@ -583,6 +594,10 @@ impl Quantile { // optional double quantile = 1; + + pub fn get_quantile(&self) -> f64 { + self.quantile.unwrap_or(0.) + } pub fn clear_quantile(&mut self) { self.quantile = ::std::option::Option::None; } @@ -596,12 +611,12 @@ impl Quantile { self.quantile = ::std::option::Option::Some(v); } - pub fn get_quantile(&self) -> f64 { - self.quantile.unwrap_or(0.) - } - // optional double value = 2; + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } pub fn clear_value(&mut self) { self.value = ::std::option::Option::None; } @@ -614,10 +629,6 @@ impl Quantile { 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 { @@ -689,13 +700,13 @@ impl ::protobuf::Message for Quantile { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -708,10 +719,7 @@ impl ::protobuf::Message for Quantile { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -725,7 +733,7 @@ impl ::protobuf::Message for Quantile { |m: &Quantile| { &m.value }, |m: &mut Quantile| { &mut m.value }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Quantile", fields, file_descriptor_proto() @@ -735,10 +743,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Quantile::new) } @@ -747,8 +752,8 @@ impl ::protobuf::Message for Quantile { impl ::protobuf::Clear for Quantile { fn clear(&mut self) { - self.clear_quantile(); - self.clear_value(); + self.quantile = ::std::option::Option::None; + self.value = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -760,8 +765,8 @@ impl ::std::fmt::Debug for Quantile { } impl ::protobuf::reflect::ProtobufValue for Quantile { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -776,6 +781,12 @@ pub struct Summary { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Summary { + fn default() -> &'a Summary { + ::default_instance() + } +} + impl Summary { pub fn new() -> Summary { ::std::default::Default::default() @@ -783,6 +794,10 @@ impl Summary { // optional uint64 sample_count = 1; + + pub fn get_sample_count(&self) -> u64 { + self.sample_count.unwrap_or(0) + } pub fn clear_sample_count(&mut self) { self.sample_count = ::std::option::Option::None; } @@ -796,12 +811,12 @@ impl Summary { 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 get_sample_sum(&self) -> f64 { + self.sample_sum.unwrap_or(0.) + } pub fn clear_sample_sum(&mut self) { self.sample_sum = ::std::option::Option::None; } @@ -815,12 +830,12 @@ impl Summary { 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 get_quantile(&self) -> &[Quantile] { + &self.quantile + } pub fn clear_quantile(&mut self) { self.quantile.clear(); } @@ -839,10 +854,6 @@ impl Summary { 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 { @@ -931,13 +942,13 @@ impl ::protobuf::Message for Summary { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -950,10 +961,7 @@ impl ::protobuf::Message for Summary { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -972,7 +980,7 @@ impl ::protobuf::Message for Summary { |m: &Summary| { &m.quantile }, |m: &mut Summary| { &mut m.quantile }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Summary", fields, file_descriptor_proto() @@ -982,10 +990,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Summary::new) } @@ -994,9 +999,9 @@ impl ::protobuf::Message for Summary { impl ::protobuf::Clear for Summary { fn clear(&mut self) { - self.clear_sample_count(); - self.clear_sample_sum(); - self.clear_quantile(); + self.sample_count = ::std::option::Option::None; + self.sample_sum = ::std::option::Option::None; + self.quantile.clear(); self.unknown_fields.clear(); } } @@ -1008,8 +1013,8 @@ impl ::std::fmt::Debug for Summary { } impl ::protobuf::reflect::ProtobufValue for Summary { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -1022,6 +1027,12 @@ pub struct Untyped { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Untyped { + fn default() -> &'a Untyped { + ::default_instance() + } +} + impl Untyped { pub fn new() -> Untyped { ::std::default::Default::default() @@ -1029,6 +1040,10 @@ impl Untyped { // optional double value = 1; + + pub fn get_value(&self) -> f64 { + self.value.unwrap_or(0.) + } pub fn clear_value(&mut self) { self.value = ::std::option::Option::None; } @@ -1041,10 +1056,6 @@ impl Untyped { 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 { @@ -1103,13 +1114,13 @@ impl ::protobuf::Message for Untyped { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -1122,10 +1133,7 @@ impl ::protobuf::Message for Untyped { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -1134,7 +1142,7 @@ impl ::protobuf::Message for Untyped { |m: &Untyped| { &m.value }, |m: &mut Untyped| { &mut m.value }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Untyped", fields, file_descriptor_proto() @@ -1144,10 +1152,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Untyped::new) } @@ -1156,7 +1161,7 @@ impl ::protobuf::Message for Untyped { impl ::protobuf::Clear for Untyped { fn clear(&mut self) { - self.clear_value(); + self.value = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -1168,8 +1173,8 @@ impl ::std::fmt::Debug for Untyped { } impl ::protobuf::reflect::ProtobufValue for Untyped { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -1184,6 +1189,12 @@ pub struct Histogram { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Histogram { + fn default() -> &'a Histogram { + ::default_instance() + } +} + impl Histogram { pub fn new() -> Histogram { ::std::default::Default::default() @@ -1191,6 +1202,10 @@ impl Histogram { // optional uint64 sample_count = 1; + + pub fn get_sample_count(&self) -> u64 { + self.sample_count.unwrap_or(0) + } pub fn clear_sample_count(&mut self) { self.sample_count = ::std::option::Option::None; } @@ -1204,12 +1219,12 @@ impl Histogram { 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 get_sample_sum(&self) -> f64 { + self.sample_sum.unwrap_or(0.) + } pub fn clear_sample_sum(&mut self) { self.sample_sum = ::std::option::Option::None; } @@ -1223,12 +1238,12 @@ impl Histogram { 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 get_bucket(&self) -> &[Bucket] { + &self.bucket + } pub fn clear_bucket(&mut self) { self.bucket.clear(); } @@ -1247,10 +1262,6 @@ impl Histogram { 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 { @@ -1339,13 +1350,13 @@ impl ::protobuf::Message for Histogram { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -1358,10 +1369,7 @@ impl ::protobuf::Message for Histogram { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -1380,7 +1388,7 @@ impl ::protobuf::Message for Histogram { |m: &Histogram| { &m.bucket }, |m: &mut Histogram| { &mut m.bucket }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Histogram", fields, file_descriptor_proto() @@ -1390,10 +1398,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Histogram::new) } @@ -1402,9 +1407,9 @@ impl ::protobuf::Message for Histogram { impl ::protobuf::Clear for Histogram { fn clear(&mut self) { - self.clear_sample_count(); - self.clear_sample_sum(); - self.clear_bucket(); + self.sample_count = ::std::option::Option::None; + self.sample_sum = ::std::option::Option::None; + self.bucket.clear(); self.unknown_fields.clear(); } } @@ -1416,8 +1421,8 @@ impl ::std::fmt::Debug for Histogram { } impl ::protobuf::reflect::ProtobufValue for Histogram { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -1431,6 +1436,12 @@ pub struct Bucket { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Bucket { + fn default() -> &'a Bucket { + ::default_instance() + } +} + impl Bucket { pub fn new() -> Bucket { ::std::default::Default::default() @@ -1438,6 +1449,10 @@ impl Bucket { // optional uint64 cumulative_count = 1; + + pub fn get_cumulative_count(&self) -> u64 { + self.cumulative_count.unwrap_or(0) + } pub fn clear_cumulative_count(&mut self) { self.cumulative_count = ::std::option::Option::None; } @@ -1451,12 +1466,12 @@ impl Bucket { 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 get_upper_bound(&self) -> f64 { + self.upper_bound.unwrap_or(0.) + } pub fn clear_upper_bound(&mut self) { self.upper_bound = ::std::option::Option::None; } @@ -1469,10 +1484,6 @@ impl Bucket { 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 { @@ -1544,13 +1555,13 @@ impl ::protobuf::Message for Bucket { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -1563,10 +1574,7 @@ impl ::protobuf::Message for Bucket { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -1580,7 +1588,7 @@ impl ::protobuf::Message for Bucket { |m: &Bucket| { &m.upper_bound }, |m: &mut Bucket| { &mut m.upper_bound }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Bucket", fields, file_descriptor_proto() @@ -1590,10 +1598,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Bucket::new) } @@ -1602,8 +1607,8 @@ impl ::protobuf::Message for Bucket { impl ::protobuf::Clear for Bucket { fn clear(&mut self) { - self.clear_cumulative_count(); - self.clear_upper_bound(); + self.cumulative_count = ::std::option::Option::None; + self.upper_bound = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -1615,8 +1620,8 @@ impl ::std::fmt::Debug for Bucket { } impl ::protobuf::reflect::ProtobufValue for Bucket { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -1635,6 +1640,12 @@ pub struct Metric { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a Metric { + fn default() -> &'a Metric { + ::default_instance() + } +} + impl Metric { pub fn new() -> Metric { ::std::default::Default::default() @@ -1642,6 +1653,10 @@ impl Metric { // repeated .io.prometheus.client.LabelPair label = 1; + + pub fn get_label(&self) -> &[LabelPair] { + &self.label + } pub fn clear_label(&mut self) { self.label.clear(); } @@ -1661,12 +1676,12 @@ impl Metric { ::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 get_gauge(&self) -> &Gauge { + self.gauge.as_ref().unwrap_or_else(|| Gauge::default_instance()) + } pub fn clear_gauge(&mut self) { self.gauge.clear(); } @@ -1694,12 +1709,12 @@ impl Metric { 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 get_counter(&self) -> &Counter { + self.counter.as_ref().unwrap_or_else(|| Counter::default_instance()) + } pub fn clear_counter(&mut self) { self.counter.clear(); } @@ -1727,12 +1742,12 @@ impl Metric { 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 get_summary(&self) -> &Summary { + self.summary.as_ref().unwrap_or_else(|| Summary::default_instance()) + } pub fn clear_summary(&mut self) { self.summary.clear(); } @@ -1760,12 +1775,12 @@ impl Metric { 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 get_untyped(&self) -> &Untyped { + self.untyped.as_ref().unwrap_or_else(|| Untyped::default_instance()) + } pub fn clear_untyped(&mut self) { self.untyped.clear(); } @@ -1793,12 +1808,12 @@ impl Metric { 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 get_histogram(&self) -> &Histogram { + self.histogram.as_ref().unwrap_or_else(|| Histogram::default_instance()) + } pub fn clear_histogram(&mut self) { self.histogram.clear(); } @@ -1826,12 +1841,12 @@ impl Metric { 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 get_timestamp_ms(&self) -> i64 { + self.timestamp_ms.unwrap_or(0) + } pub fn clear_timestamp_ms(&mut self) { self.timestamp_ms = ::std::option::Option::None; } @@ -1844,10 +1859,6 @@ impl Metric { 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 { @@ -2008,13 +2019,13 @@ impl ::protobuf::Message for Metric { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -2027,10 +2038,7 @@ impl ::protobuf::Message for Metric { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -2069,7 +2077,7 @@ impl ::protobuf::Message for Metric { |m: &Metric| { &m.timestamp_ms }, |m: &mut Metric| { &mut m.timestamp_ms }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "Metric", fields, file_descriptor_proto() @@ -2079,10 +2087,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(Metric::new) } @@ -2091,13 +2096,13 @@ impl ::protobuf::Message for Metric { 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.label.clear(); + self.gauge.clear(); + self.counter.clear(); + self.summary.clear(); + self.untyped.clear(); + self.histogram.clear(); + self.timestamp_ms = ::std::option::Option::None; self.unknown_fields.clear(); } } @@ -2109,8 +2114,8 @@ impl ::std::fmt::Debug for Metric { } impl ::protobuf::reflect::ProtobufValue for Metric { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -2126,6 +2131,12 @@ pub struct MetricFamily { pub cached_size: ::protobuf::CachedSize, } +impl<'a> ::std::default::Default for &'a MetricFamily { + fn default() -> &'a MetricFamily { + ::default_instance() + } +} + impl MetricFamily { pub fn new() -> MetricFamily { ::std::default::Default::default() @@ -2133,6 +2144,13 @@ impl MetricFamily { // optional string name = 1; + + pub fn get_name(&self) -> &str { + match self.name.as_ref() { + Some(v) => &v, + None => "", + } + } pub fn clear_name(&mut self) { self.name.clear(); } @@ -2160,15 +2178,15 @@ impl MetricFamily { self.name.take().unwrap_or_else(|| ::std::string::String::new()) } - pub fn get_name(&self) -> &str { - match self.name.as_ref() { + // optional string help = 2; + + + pub fn get_help(&self) -> &str { + match self.help.as_ref() { Some(v) => &v, None => "", } } - - // optional string help = 2; - pub fn clear_help(&mut self) { self.help.clear(); } @@ -2196,15 +2214,12 @@ impl MetricFamily { 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 get_field_type(&self) -> MetricType { + self.field_type.unwrap_or(MetricType::COUNTER) + } pub fn clear_field_type(&mut self) { self.field_type = ::std::option::Option::None; } @@ -2218,12 +2233,12 @@ impl MetricFamily { 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 get_metric(&self) -> &[Metric] { + &self.metric + } pub fn clear_metric(&mut self) { self.metric.clear(); } @@ -2242,10 +2257,6 @@ impl MetricFamily { 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 { @@ -2335,13 +2346,13 @@ impl ::protobuf::Message for MetricFamily { &mut self.unknown_fields } - fn as_any(&self) -> &::std::any::Any { - self as &::std::any::Any + fn as_any(&self) -> &dyn (::std::any::Any) { + self as &dyn (::std::any::Any) } - fn as_any_mut(&mut self) -> &mut ::std::any::Any { - self as &mut ::std::any::Any + fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { + self as &mut dyn (::std::any::Any) } - fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + fn into_any(self: Box) -> ::std::boxed::Box { self } @@ -2354,10 +2365,7 @@ impl ::protobuf::Message for MetricFamily { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { let mut fields = ::std::vec::Vec::new(); @@ -2381,7 +2389,7 @@ impl ::protobuf::Message for MetricFamily { |m: &MetricFamily| { &m.metric }, |m: &mut MetricFamily| { &mut m.metric }, )); - ::protobuf::reflect::MessageDescriptor::new::( + ::protobuf::reflect::MessageDescriptor::new_pb_name::( "MetricFamily", fields, file_descriptor_proto() @@ -2391,10 +2399,7 @@ 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, - }; + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; unsafe { instance.get(MetricFamily::new) } @@ -2403,10 +2408,10 @@ impl ::protobuf::Message for MetricFamily { impl ::protobuf::Clear for MetricFamily { fn clear(&mut self) { - self.clear_name(); - self.clear_help(); - self.clear_field_type(); - self.clear_metric(); + self.name.clear(); + self.help.clear(); + self.field_type = ::std::option::Option::None; + self.metric.clear(); self.unknown_fields.clear(); } } @@ -2418,8 +2423,8 @@ impl ::std::fmt::Debug for MetricFamily { } impl ::protobuf::reflect::ProtobufValue for MetricFamily { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Message(self) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Message(self) } } @@ -2460,13 +2465,10 @@ impl ::protobuf::ProtobufEnum for MetricType { } 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, - }; + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT; unsafe { descriptor.get(|| { - ::protobuf::reflect::EnumDescriptor::new("MetricType", file_descriptor_proto()) + ::protobuf::reflect::EnumDescriptor::new_pb_name::("MetricType", file_descriptor_proto()) }) } } @@ -2475,49 +2477,49 @@ impl ::protobuf::ProtobufEnum for MetricType { impl ::std::marker::Copy for MetricType { } +impl ::std::default::Default for MetricType { + fn default() -> Self { + MetricType::COUNTER + } +} + impl ::protobuf::reflect::ProtobufValue for MetricType { - fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef<'_> { - ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { + ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor()) } } static file_descriptor_proto_data: &'static [u8] = b"\ - \n\x11proto_model.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\x08quant\ - ile\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\ + \n\x11proto_model.proto\x12\x14io.prometheus.client\".\n\tLabelPair\x12\ + \x0e\n\x04name\x18\x01\x20\x01(\tB\0\x12\x0f\n\x05value\x18\x02\x20\x01(\ + \tB\0:\0\"\x1a\n\x05Gauge\x12\x0f\n\x05value\x18\x01\x20\x01(\x01B\0:\0\ + \"\x1c\n\x07Counter\x12\x0f\n\x05value\x18\x01\x20\x01(\x01B\0:\0\"1\n\ + \x08Quantile\x12\x12\n\x08quantile\x18\x01\x20\x01(\x01B\0\x12\x0f\n\x05\ + value\x18\x02\x20\x01(\x01B\0:\0\"m\n\x07Summary\x12\x16\n\x0csample_cou\ + nt\x18\x01\x20\x01(\x04B\0\x12\x14\n\nsample_sum\x18\x02\x20\x01(\x01B\0\ + \x122\n\x08quantile\x18\x03\x20\x03(\x0b2\x1e.io.prometheus.client.Quant\ + ileB\0:\0\"\x1c\n\x07Untyped\x12\x0f\n\x05value\x18\x01\x20\x01(\x01B\0:\ + \0\"k\n\tHistogram\x12\x16\n\x0csample_count\x18\x01\x20\x01(\x04B\0\x12\ + \x14\n\nsample_sum\x18\x02\x20\x01(\x01B\0\x12.\n\x06bucket\x18\x03\x20\ + \x03(\x0b2\x1c.io.prometheus.client.BucketB\0:\0\"=\n\x06Bucket\x12\x1a\ + \n\x10cumulative_count\x18\x01\x20\x01(\x04B\0\x12\x15\n\x0bupper_bound\ + \x18\x02\x20\x01(\x01B\0:\0\"\xce\x02\n\x06Metric\x120\n\x05label\x18\ + \x01\x20\x03(\x0b2\x1f.io.prometheus.client.LabelPairB\0\x12,\n\x05gauge\ + \x18\x02\x20\x01(\x0b2\x1b.io.prometheus.client.GaugeB\0\x120\n\x07count\ + er\x18\x03\x20\x01(\x0b2\x1d.io.prometheus.client.CounterB\0\x120\n\x07s\ + ummary\x18\x04\x20\x01(\x0b2\x1d.io.prometheus.client.SummaryB\0\x120\n\ + \x07untyped\x18\x05\x20\x01(\x0b2\x1d.io.prometheus.client.UntypedB\0\ + \x124\n\thistogram\x18\x07\x20\x01(\x0b2\x1f.io.prometheus.client.Histog\ + ramB\0\x12\x16\n\x0ctimestamp_ms\x18\x06\x20\x01(\x03B\0:\0\"\x92\x01\n\ + \x0cMetricFamily\x12\x0e\n\x04name\x18\x01\x20\x01(\tB\0\x12\x0e\n\x04he\ + lp\x18\x02\x20\x01(\tB\0\x120\n\x04type\x18\x03\x20\x01(\x0e2\x20.io.pro\ + metheus.client.MetricTypeB\0\x12.\n\x06metric\x18\x04\x20\x03(\x0b2\x1c.\ + io.prometheus.client.MetricB\0:\0*O\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\0B\0b\x06proto2\ "; -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, -}; +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() diff --git a/src/macros.rs b/src/macros.rs index 61511c73..cfd7dd02 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -120,12 +120,12 @@ macro_rules! histogram_opts { }}; ($NAME:expr, $HELP:expr, $BUCKETS:expr) => {{ - let hopts = histogram_opts!($NAME, $HELP); + let hopts = $crate::histogram_opts!($NAME, $HELP); hopts.buckets($BUCKETS) }}; ($NAME:expr, $HELP:expr, $BUCKETS:expr, $CONST_LABELS:expr) => {{ - let hopts = histogram_opts!($NAME, $HELP, $BUCKETS); + let hopts = $crate::histogram_opts!($NAME, $HELP, $BUCKETS); hopts.const_labels($CONST_LABELS) }}; } @@ -153,11 +153,11 @@ macro_rules! register_counter { }}; ($OPTS:expr) => {{ - register_counter!(@of_type Counter, $OPTS) + $crate::register_counter!(@of_type Counter, $OPTS) }}; ($NAME:expr, $HELP:expr) => {{ - register_counter!(opts!($NAME, $HELP)) + $crate::register_counter!(opts!($NAME, $HELP)) }}; } @@ -167,11 +167,11 @@ macro_rules! register_counter { #[macro_export(local_inner_macros)] macro_rules! register_int_counter { ($OPTS:expr) => {{ - register_counter!(@of_type IntCounter, $OPTS) + $crate::register_counter!(@of_type IntCounter, $OPTS) }}; ($NAME:expr, $HELP:expr) => {{ - register_int_counter!(opts!($NAME, $HELP)) + $crate::register_int_counter!(opts!($NAME, $HELP)) }}; } @@ -202,11 +202,11 @@ macro_rules! __register_counter_vec { #[macro_export(local_inner_macros)] macro_rules! register_counter_vec { ($OPTS:expr, $LABELS_NAMES:expr) => {{ - __register_counter_vec!(CounterVec, $OPTS, $LABELS_NAMES) + $crate::__register_counter_vec!(CounterVec, $OPTS, $LABELS_NAMES) }}; ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr) => {{ - register_counter_vec!(opts!($NAME, $HELP), $LABELS_NAMES) + $crate::register_counter_vec!(opts!($NAME, $HELP), $LABELS_NAMES) }}; } @@ -216,11 +216,11 @@ macro_rules! register_counter_vec { #[macro_export(local_inner_macros)] macro_rules! register_int_counter_vec { ($OPTS:expr, $LABELS_NAMES:expr) => {{ - __register_counter_vec!(IntCounterVec, $OPTS, $LABELS_NAMES) + $crate::__register_counter_vec!(IntCounterVec, $OPTS, $LABELS_NAMES) }}; ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr) => {{ - register_int_counter_vec!(opts!($NAME, $HELP), $LABELS_NAMES) + $crate::register_int_counter_vec!(opts!($NAME, $HELP), $LABELS_NAMES) }}; } @@ -251,11 +251,11 @@ macro_rules! __register_gauge { #[macro_export(local_inner_macros)] macro_rules! register_gauge { ($OPTS:expr) => {{ - __register_gauge!(Gauge, $OPTS) + $crate::__register_gauge!(Gauge, $OPTS) }}; ($NAME:expr, $HELP:expr) => {{ - register_gauge!(opts!($NAME, $HELP)) + $crate::register_gauge!(opts!($NAME, $HELP)) }}; } @@ -265,11 +265,11 @@ macro_rules! register_gauge { #[macro_export(local_inner_macros)] macro_rules! register_int_gauge { ($OPTS:expr) => {{ - __register_gauge!(IntGauge, $OPTS) + $crate::__register_gauge!(IntGauge, $OPTS) }}; ($NAME:expr, $HELP:expr) => {{ - register_int_gauge!(opts!($NAME, $HELP)) + $crate::register_int_gauge!(opts!($NAME, $HELP)) }}; } @@ -300,11 +300,11 @@ macro_rules! __register_gauge_vec { #[macro_export(local_inner_macros)] macro_rules! register_gauge_vec { ($OPTS:expr, $LABELS_NAMES:expr) => {{ - __register_gauge_vec!(GaugeVec, $OPTS, $LABELS_NAMES) + $crate::__register_gauge_vec!(GaugeVec, $OPTS, $LABELS_NAMES) }}; ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr) => {{ - register_gauge_vec!(opts!($NAME, $HELP), $LABELS_NAMES) + $crate::register_gauge_vec!(opts!($NAME, $HELP), $LABELS_NAMES) }}; } @@ -314,11 +314,11 @@ macro_rules! register_gauge_vec { #[macro_export(local_inner_macros)] macro_rules! register_int_gauge_vec { ($OPTS:expr, $LABELS_NAMES:expr) => {{ - __register_gauge_vec!(IntGaugeVec, $OPTS, $LABELS_NAMES) + $crate::__register_gauge_vec!(IntGaugeVec, $OPTS, $LABELS_NAMES) }}; ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr) => {{ - register_int_gauge_vec!(opts!($NAME, $HELP), $LABELS_NAMES) + $crate::register_int_gauge_vec!(opts!($NAME, $HELP), $LABELS_NAMES) }}; } @@ -345,11 +345,11 @@ macro_rules! register_int_gauge_vec { #[macro_export(local_inner_macros)] macro_rules! register_histogram { ($NAME:expr, $HELP:expr) => { - register_histogram!(histogram_opts!($NAME, $HELP)) + $crate::register_histogram!(histogram_opts!($NAME, $HELP)) }; ($NAME:expr, $HELP:expr, $BUCKETS:expr) => { - register_histogram!(histogram_opts!($NAME, $HELP, $BUCKETS)) + $crate::register_histogram!(histogram_opts!($NAME, $HELP, $BUCKETS)) }; ($HOPTS:expr) => {{ @@ -388,10 +388,10 @@ macro_rules! register_histogram_vec { }}; ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr) => {{ - register_histogram_vec!(histogram_opts!($NAME, $HELP), $LABELS_NAMES) + $crate::register_histogram_vec!(histogram_opts!($NAME, $HELP), $LABELS_NAMES) }}; ($NAME:expr, $HELP:expr, $LABELS_NAMES:expr, $BUCKETS:expr) => {{ - register_histogram_vec!(histogram_opts!($NAME, $HELP, $BUCKETS), $LABELS_NAMES) + $crate::register_histogram_vec!(histogram_opts!($NAME, $HELP, $BUCKETS), $LABELS_NAMES) }}; }