Skip to content

Commit 77d0089

Browse files
authored
Merge pull request #935 from muzarski/remove_public_usages_of_histogram
Remove `histogram::Histogram` from public API
2 parents 8a5be0a + caa559c commit 77d0089

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

scylla/src/transport/metrics.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,23 @@
11
use histogram::Histogram;
22
use std::sync::atomic::{AtomicU64, Ordering};
3-
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
3+
use std::sync::{Arc, Mutex};
44

55
const ORDER_TYPE: Ordering = Ordering::Relaxed;
66

77
#[derive(Debug)]
8-
pub enum MetricsError<'a> {
9-
Poison(PoisonError<MutexGuard<'a, Histogram>>),
10-
Histogram(&'static str),
8+
pub struct MetricsError {
9+
cause: &'static str,
1110
}
1211

13-
impl<'a> From<PoisonError<MutexGuard<'a, Histogram>>> for MetricsError<'a> {
14-
fn from(err: PoisonError<MutexGuard<'_, Histogram>>) -> MetricsError {
15-
MetricsError::Poison(err)
16-
}
17-
}
18-
19-
impl From<&'static str> for MetricsError<'_> {
12+
impl From<&'static str> for MetricsError {
2013
fn from(err: &'static str) -> MetricsError {
21-
MetricsError::Histogram(err)
14+
MetricsError { cause: err }
2215
}
2316
}
2417

25-
impl std::fmt::Display for MetricsError<'_> {
18+
impl std::fmt::Display for MetricsError {
2619
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27-
write!(f, "{:?}", self)
20+
write!(f, "metrics error: {}", self.cause)
2821
}
2922
}
3023

0 commit comments

Comments
 (0)