1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
//use core::ops::{Deref, DerefMut};
use core::panic::{RefUnwindSafe, UnwindSafe};
use crate::*;
// maybe we shouldn't have Deref? we want to make it hard to fuck things up.
//impl<'a, T: ?Sized> Deref for ConstLtPtr<'a, T> {
// type Target = *const T;
// fn deref(&self) -> &*const T {
// &self.raw
// }
//}
//
//impl<'a, T: ?Sized> DerefMut for ConstLtPtr<'a, T> {
// fn deref_mut(&mut self) -> &mut *const T {
// &mut self.raw
// }
//}
//
//impl<'a, T: ?Sized> Deref for MutLtPtr<'a, T> {
// type Target = *mut T;
// fn deref(&self) -> &*mut T {
// &self.raw
// }
//}
//
//impl<'a, T: ?Sized> DerefMut for MutLtPtr<'a, T> {
// fn deref_mut(&mut self) -> &mut *mut T {
// &mut self.raw
// }
//}
// *mut T are UnwindSafe, so ours should be too.
impl<'a, T: RefUnwindSafe + ?Sized> UnwindSafe for MutLtPtr<'a, T> {}
impl<'a, T: ?Sized> Copy for ConstLtPtr<'a, T> {}
impl<'a, T: ?Sized> Clone for ConstLtPtr<'a, T> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<'a, T: ?Sized> core::fmt::Debug for ConstLtPtr<'a, T> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Debug::fmt(&self.raw, f)
}
}
impl<'a, T: ?Sized> core::fmt::Pointer for ConstLtPtr<'a, T> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Pointer::fmt(&self.raw, f)
}
}
impl<'a, T: ?Sized> core::hash::Hash for ConstLtPtr<'a, T> {
#[inline]
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
core::hash::Hash::hash(&self.raw, state)
}
}
impl<'a, T: ?Sized> core::cmp::Ord for ConstLtPtr<'a, T> {
#[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
core::cmp::Ord::cmp(&self.raw, &other.raw)
}
}
impl<'a, T: ?Sized> core::cmp::Eq for ConstLtPtr<'a, T> {}
impl<'a, T: ?Sized> core::cmp::PartialEq for ConstLtPtr<'a, T> {
#[inline]
fn eq(&self, other: &Self) -> bool {
core::cmp::PartialEq::eq(&self.raw, &other.raw)
}
}
impl<'a, T: ?Sized> core::cmp::PartialOrd for ConstLtPtr<'a, T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
core::cmp::PartialOrd::partial_cmp(&self.raw, &other.raw)
}
#[inline]
fn lt(&self, other: &Self) -> bool {
core::cmp::PartialOrd::lt(&self.raw, &other.raw)
}
#[inline]
fn le(&self, other: &Self) -> bool {
core::cmp::PartialOrd::le(&self.raw, &other.raw)
}
#[inline]
fn gt(&self, other: &Self) -> bool {
core::cmp::PartialOrd::gt(&self.raw, &other.raw)
}
#[inline]
fn ge(&self, other: &Self) -> bool {
core::cmp::PartialOrd::ge(&self.raw, &other.raw)
}
}
impl<'a, T: ?Sized> Copy for MutLtPtr<'a, T> {}
impl<'a, T: ?Sized> Clone for MutLtPtr<'a, T> {
#[inline]
fn clone(&self) -> Self {
*self
}
}
impl<'a, T: ?Sized> core::fmt::Debug for MutLtPtr<'a, T> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Debug::fmt(&self.raw, f)
}
}
impl<'a, T: ?Sized> core::fmt::Pointer for MutLtPtr<'a, T> {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
core::fmt::Pointer::fmt(&self.raw, f)
}
}
impl<'a, T: ?Sized> core::hash::Hash for MutLtPtr<'a, T> {
#[inline]
fn hash<H: core::hash::Hasher>(&self, state: &mut H) {
core::hash::Hash::hash(&self.raw, state)
}
}
impl<'a, T: ?Sized> core::cmp::Ord for MutLtPtr<'a, T> {
#[inline]
fn cmp(&self, other: &Self) -> core::cmp::Ordering {
core::cmp::Ord::cmp(&self.raw, &other.raw)
}
}
impl<'a, T: ?Sized> core::cmp::Eq for MutLtPtr<'a, T> {}
impl<'a, T: ?Sized> core::cmp::PartialEq for MutLtPtr<'a, T> {
#[inline]
fn eq(&self, other: &Self) -> bool {
core::cmp::PartialEq::eq(&self.raw, &other.raw)
}
}
impl<'a, T: ?Sized> core::cmp::PartialOrd for MutLtPtr<'a, T> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
core::cmp::PartialOrd::partial_cmp(&self.raw, &other.raw)
}
#[inline]
fn lt(&self, other: &Self) -> bool {
core::cmp::PartialOrd::lt(&self.raw, &other.raw)
}
#[inline]
fn le(&self, other: &Self) -> bool {
core::cmp::PartialOrd::le(&self.raw, &other.raw)
}
#[inline]
fn gt(&self, other: &Self) -> bool {
core::cmp::PartialOrd::gt(&self.raw, &other.raw)
}
#[inline]
fn ge(&self, other: &Self) -> bool {
core::cmp::PartialOrd::ge(&self.raw, &other.raw)
}
}
|