derive Copy on FoundIn

This commit is contained in:
Charles Hall 2024-06-04 12:31:24 -07:00
parent 784b86a1f6
commit 792300d220
No known key found for this signature in database
GPG key ID: 7B8E0645816E07CF

View file

@ -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());
}
}