From 786e68129d6228bc2c85f9b92e3c4f4b5a520435 Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Tue, 4 Jun 2024 12:31:24 -0700 Subject: [PATCH] derive Copy on FoundIn --- src/observability.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/observability.rs b/src/observability.rs index 054ee7a9..4e4cec0a 100644 --- a/src/observability.rs +++ b/src/observability.rs @@ -41,6 +41,7 @@ impl Drop for Guard { } /// Type to record cache performance in a tracing span field. +#[derive(Clone, Copy)] pub(crate) enum FoundIn { /// Found in cache Cache, @@ -55,7 +56,7 @@ pub(crate) enum FoundIn { impl FoundIn { /// Returns a stringified representation of the current value - fn as_str(&self) -> &'static str { + fn as_str(self) -> &'static str { match self { FoundIn::Cache => "Cache", FoundIn::Database => "Database", @@ -66,7 +67,7 @@ impl FoundIn { /// Record the current value to the current [`tracing::Span`] // TODO: use tracing::Value instead if it ever becomes accessible - pub(crate) fn record(&self, field: &str) { + pub(crate) fn record(self, field: &str) { tracing::Span::current().record(field, self.as_str()); } }