@@ -203,8 +203,8 @@ impl HardwareBuffer {
203203 Self ( buffer_ptr)
204204 }
205205
206- /// Creates a new Rust HardwareBuffer to wrap the given AHardwareBuffer without taking ownership
207- /// of it.
206+ /// Creates a new Rust HardwareBuffer to wrap the given ` AHardwareBuffer` without taking
207+ /// ownership of it.
208208 ///
209209 /// Unlike [`from_raw`](Self::from_raw) this method will increment the refcount on the buffer.
210210 /// This means that the caller can continue to use the raw buffer it passed in, and must call
@@ -220,14 +220,20 @@ impl HardwareBuffer {
220220 Self ( buffer)
221221 }
222222
223- /// Get the internal `AHardwareBuffer` pointer that is only valid when this `HardwareBuffer`
224- /// exists. This can be used to provide a pointer to the AHB for a C/C++ API over the FFI.
223+ /// Returns the internal `AHardwareBuffer` pointer.
224+ ///
225+ /// This is only valid as long as this `HardwareBuffer` exists, so shouldn't be stored. It can
226+ /// be used to provide a pointer for a C/C++ API over FFI.
225227 pub fn as_raw ( & self ) -> NonNull < AHardwareBuffer > {
226228 self . 0
227229 }
228230
229- /// Get the internal `AHardwareBuffer` pointer without decrementing the refcount. This can
230- /// be used to provide a pointer to the AHB for a C/C++ API over the FFI.
231+ /// Gets the internal `AHardwareBuffer` pointer without decrementing the refcount. This can
232+ /// be used for a C/C++ API which takes ownership of the pointer.
233+ ///
234+ /// The caller is responsible for releasing the `AHardwareBuffer` pointer by calling
235+ /// `AHardwareBuffer_release` when it is finished with it, or may convert it back to a Rust
236+ /// `HardwareBuffer` by calling [`HardwareBuffer::from_raw`].
231237 pub fn into_raw ( self ) -> NonNull < AHardwareBuffer > {
232238 let buffer = ManuallyDrop :: new ( self ) ;
233239 buffer. 0
0 commit comments