mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 15:51:23 +01:00
derive Copy on FoundIn
This commit is contained in:
parent
a8a7cece1d
commit
786e68129d
1 changed files with 3 additions and 2 deletions
|
|
@ -41,6 +41,7 @@ impl Drop for Guard {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Type to record cache performance in a tracing span field.
|
/// Type to record cache performance in a tracing span field.
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
pub(crate) enum FoundIn {
|
pub(crate) enum FoundIn {
|
||||||
/// Found in cache
|
/// Found in cache
|
||||||
Cache,
|
Cache,
|
||||||
|
|
@ -55,7 +56,7 @@ pub(crate) enum FoundIn {
|
||||||
|
|
||||||
impl FoundIn {
|
impl FoundIn {
|
||||||
/// Returns a stringified representation of the current value
|
/// Returns a stringified representation of the current value
|
||||||
fn as_str(&self) -> &'static str {
|
fn as_str(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
FoundIn::Cache => "Cache",
|
FoundIn::Cache => "Cache",
|
||||||
FoundIn::Database => "Database",
|
FoundIn::Database => "Database",
|
||||||
|
|
@ -66,7 +67,7 @@ impl FoundIn {
|
||||||
|
|
||||||
/// Record the current value to the current [`tracing::Span`]
|
/// Record the current value to the current [`tracing::Span`]
|
||||||
// TODO: use tracing::Value instead if it ever becomes accessible
|
// 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());
|
tracing::Span::current().record(field, self.as_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue