deranged/
unsafe_wrapper.rs1#[derive(#[automatically_derived]
impl<T: ::core::clone::Clone> ::core::clone::Clone for Unsafe<T> {
#[inline]
fn clone(&self) -> Unsafe<T> {
Unsafe(::core::clone::Clone::clone(&self.0))
}
}Clone, #[automatically_derived]
impl<T: ::core::marker::Copy> ::core::marker::Copy for Unsafe<T> { }Copy, #[automatically_derived]
impl<T: ::core::cmp::PartialEq> ::core::cmp::PartialEq for Unsafe<T> {
#[inline]
fn eq(&self, other: &Unsafe<T>) -> bool { self.0 == other.0 }
}PartialEq, #[automatically_derived]
impl<T: ::core::cmp::Eq> ::core::cmp::Eq for Unsafe<T> {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<T>;
}
}Eq, #[automatically_derived]
impl<T: ::core::cmp::PartialOrd> ::core::cmp::PartialOrd for Unsafe<T> {
#[inline]
fn partial_cmp(&self, other: &Unsafe<T>)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0)
}
}PartialOrd, #[automatically_derived]
impl<T: ::core::cmp::Ord> ::core::cmp::Ord for Unsafe<T> {
#[inline]
fn cmp(&self, other: &Unsafe<T>) -> ::core::cmp::Ordering {
::core::cmp::Ord::cmp(&self.0, &other.0)
}
}Ord, #[automatically_derived]
impl<T: ::core::hash::Hash> ::core::hash::Hash for Unsafe<T> {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () {
::core::hash::Hash::hash(&self.0, state)
}
}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}