1use std::{error::Error, fmt};
23const SET_RECORDER_ERROR: &str =
4"attempted to set a recorder after the metrics system was already initialized";
56/// Error returned when trying to install a global recorder when another has already been installed.
7pub struct SetRecorderError<R>(pub R);
89impl<R> SetRecorderError<R> {
10/// Returns the recorder that was attempted to be set.
11pub fn into_inner(self) -> R {
12self.0
13}
14}
1516impl<R> fmt::Debug for SetRecorderError<R> {
17fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 f.debug_struct("SetRecorderError").finish_non_exhaustive()
19 }
20}
2122impl<R> fmt::Display for SetRecorderError<R> {
23fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
24 fmt.write_str(SET_RECORDER_ERROR)
25 }
26}
2728impl<R> Error for SetRecorderError<R> {}