@@ -131,18 +131,38 @@ impl<'a, T, A> VolatileRef<'a, T, A>
131
131
where
132
132
T : ?Sized ,
133
133
{
134
- pub fn as_ptr ( & self ) -> volatile_ptr:: VolatilePtr < ' _ , T , A :: RestrictShared >
134
+ /// Borrows this `VolatileRef` as a read-only [`VolatilePtr`].
135
+ ///
136
+ /// Use this method to do (partial) volatile reads of the referenced data.
137
+ pub fn as_ptr ( & self ) -> VolatilePtr < ' _ , T , A :: RestrictShared >
135
138
where
136
139
A : Access ,
137
140
{
138
- unsafe { volatile_ptr :: VolatilePtr :: new_restricted ( Default :: default ( ) , self . pointer ) }
141
+ unsafe { VolatilePtr :: new_restricted ( Default :: default ( ) , self . pointer ) }
139
142
}
140
143
141
- pub fn as_mut_ptr ( & mut self ) -> volatile_ptr:: VolatilePtr < ' _ , T , A >
144
+ /// Borrows this `VolatileRef` as a mutable [`VolatilePtr`].
145
+ ///
146
+ /// Use this method to do (partial) volatile reads or writes of the referenced data.
147
+ pub fn as_mut_ptr ( & mut self ) -> VolatilePtr < ' _ , T , A >
148
+ where
149
+ A : Access ,
150
+ {
151
+ unsafe { VolatilePtr :: new_restricted ( Default :: default ( ) , self . pointer ) }
152
+ }
153
+
154
+ /// Converts this `VolatileRef` into a [`VolatilePtr`] with full access without shortening
155
+ /// the lifetime.
156
+ ///
157
+ /// Use this method when you need a [`VolatilePtr`] instance that lives for the full
158
+ /// lifetime `'a`.
159
+ ///
160
+ /// This method consumes the `VolatileRef`.
161
+ pub fn into_ptr ( self ) -> VolatilePtr < ' a , T , A >
142
162
where
143
163
A : Access ,
144
164
{
145
- unsafe { volatile_ptr :: VolatilePtr :: new_restricted ( Default :: default ( ) , self . pointer ) }
165
+ unsafe { VolatilePtr :: new_restricted ( Default :: default ( ) , self . pointer ) }
146
166
}
147
167
}
148
168
0 commit comments