mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 23:31:24 +01:00
derive Copy on FoundIn
This commit is contained in:
parent
784b86a1f6
commit
792300d220
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.
|
||||
#[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());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue