@@ -90,9 +90,11 @@ pub unsafe trait Tag: Copy {
90
90
91
91
unsafe impl < T > Pointer for Box < T > {
92
92
const BITS : usize = std:: mem:: align_of :: < T > ( ) . trailing_zeros ( ) as usize ;
93
+ #[ inline]
93
94
fn into_usize ( self ) -> usize {
94
95
Box :: into_raw ( self ) as usize
95
96
}
97
+ #[ inline]
96
98
unsafe fn from_usize ( ptr : usize ) -> Self {
97
99
Box :: from_raw ( ptr as * mut T )
98
100
}
@@ -104,9 +106,11 @@ unsafe impl<T> Pointer for Box<T> {
104
106
105
107
unsafe impl < T > Pointer for Rc < T > {
106
108
const BITS : usize = std:: mem:: align_of :: < T > ( ) . trailing_zeros ( ) as usize ;
109
+ #[ inline]
107
110
fn into_usize ( self ) -> usize {
108
111
Rc :: into_raw ( self ) as usize
109
112
}
113
+ #[ inline]
110
114
unsafe fn from_usize ( ptr : usize ) -> Self {
111
115
Rc :: from_raw ( ptr as * const T )
112
116
}
@@ -118,9 +122,11 @@ unsafe impl<T> Pointer for Rc<T> {
118
122
119
123
unsafe impl < T > Pointer for Arc < T > {
120
124
const BITS : usize = std:: mem:: align_of :: < T > ( ) . trailing_zeros ( ) as usize ;
125
+ #[ inline]
121
126
fn into_usize ( self ) -> usize {
122
127
Arc :: into_raw ( self ) as usize
123
128
}
129
+ #[ inline]
124
130
unsafe fn from_usize ( ptr : usize ) -> Self {
125
131
Arc :: from_raw ( ptr as * const T )
126
132
}
@@ -132,9 +138,11 @@ unsafe impl<T> Pointer for Arc<T> {
132
138
133
139
unsafe impl < ' a , T : ' a > Pointer for & ' a T {
134
140
const BITS : usize = std:: mem:: align_of :: < T > ( ) . trailing_zeros ( ) as usize ;
141
+ #[ inline]
135
142
fn into_usize ( self ) -> usize {
136
143
self as * const T as usize
137
144
}
145
+ #[ inline]
138
146
unsafe fn from_usize ( ptr : usize ) -> Self {
139
147
& * ( ptr as * const T )
140
148
}
@@ -145,9 +153,11 @@ unsafe impl<'a, T: 'a> Pointer for &'a T {
145
153
146
154
unsafe impl < ' a , T : ' a > Pointer for & ' a mut T {
147
155
const BITS : usize = std:: mem:: align_of :: < T > ( ) . trailing_zeros ( ) as usize ;
156
+ #[ inline]
148
157
fn into_usize ( self ) -> usize {
149
158
self as * mut T as usize
150
159
}
160
+ #[ inline]
151
161
unsafe fn from_usize ( ptr : usize ) -> Self {
152
162
& mut * ( ptr as * mut T )
153
163
}
0 commit comments