deranged/
unsafe_wrapper.rs1#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
6pub(crate) struct Unsafe<T>(T);
7
8impl<T: core::fmt::Debug> core::fmt::Debug for Unsafe<T> {
9 #[inline]
10 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
11 self.0.fmt(f)
12 }
13}
14
15impl<T> Unsafe<T> {
16 #[inline(always)]
18 pub(crate) const unsafe fn new(value: T) -> Self {
19 Self(value)
20 }
21
22 #[inline(always)]
24 pub(crate) const fn get(&self) -> &T {
25 &self.0
26 }
27}
28
29impl<T> core::ops::Deref for Unsafe<T> {
30 type Target = T;
31
32 #[inline(always)]
33 fn deref(&self) -> &Self::Target {
34 &self.0
35 }
36}