1use std::fmt::{Debug, Formatter};
2use std::ops::{Deref, DerefMut};
3
4#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6pub struct WrapDebug<T>(pub T);
7
8impl<T> WrapDebug<T> {
9 pub fn inner(&self) -> &T {
10 &self.0
11 }
12}
13
14impl<T> Debug for WrapDebug<T> {
15 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
16 write!(f, "{}", std::any::type_name::<T>())
17 }
18}
19
20impl<T> From<T> for WrapDebug<T> {
21 fn from(value: T) -> Self {
22 WrapDebug(value)
23 }
24}
25
26impl<T> Deref for WrapDebug<T> {
27 type Target = T;
28
29 fn deref(&self) -> &Self::Target {
30 &self.0
31 }
32}
33
34impl<T> DerefMut for WrapDebug<T> {
35 fn deref_mut(&mut self) -> &mut Self::Target {
36 &mut self.0
37 }
38}