1 | #[derive (Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
2 | pub(crate) struct Unsafe<T>(T); |
3 | |
4 | impl<T: core::fmt::Debug> core::fmt::Debug for Unsafe<T> { |
5 | fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { |
6 | self.0.fmt(f) |
7 | } |
8 | } |
9 | |
10 | impl<T> Unsafe<T> { |
11 | pub(crate) const unsafe fn new(value: T) -> Self { |
12 | Self(value) |
13 | } |
14 | |
15 | pub(crate) const fn get(&self) -> &T { |
16 | &self.0 |
17 | } |
18 | } |
19 | |
20 | impl<T> core::ops::Deref for Unsafe<T> { |
21 | type Target = T; |
22 | |
23 | fn deref(&self) -> &Self::Target { |
24 | &self.0 |
25 | } |
26 | } |
27 | |