Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 150a881b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Improve formatting of doc comments and add more details." into main am:...

Merge "Improve formatting of doc comments and add more details." into main am: bcd6336d am: c43a005b

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/3315653



Change-Id: I105c38d775df07ff2816296828d1df622bd69aa7
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2db4e9e2 c43a005b
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -203,8 +203,8 @@ impl HardwareBuffer {
        Self(buffer_ptr)
    }

    /// Creates a new Rust HardwareBuffer to wrap the given AHardwareBuffer without taking ownership
    /// of it.
    /// Creates a new Rust HardwareBuffer to wrap the given `AHardwareBuffer` without taking
    /// ownership of it.
    ///
    /// Unlike [`from_raw`](Self::from_raw) this method will increment the refcount on the buffer.
    /// This means that the caller can continue to use the raw buffer it passed in, and must call
@@ -220,14 +220,20 @@ impl HardwareBuffer {
        Self(buffer)
    }

    /// Get the internal `AHardwareBuffer` pointer that is only valid when this `HardwareBuffer`
    /// exists. This can be used to provide a pointer to the AHB for a C/C++ API over the FFI.
    /// Returns the internal `AHardwareBuffer` pointer.
    ///
    /// This is only valid as long as this `HardwareBuffer` exists, so shouldn't be stored. It can
    /// be used to provide a pointer for a C/C++ API over FFI.
    pub fn as_raw(&self) -> NonNull<AHardwareBuffer> {
        self.0
    }

    /// Get the internal `AHardwareBuffer` pointer without decrementing the refcount. This can
    /// be used to provide a pointer to the AHB for a C/C++ API over the FFI.
    /// Gets the internal `AHardwareBuffer` pointer without decrementing the refcount. This can
    /// be used for a C/C++ API which takes ownership of the pointer.
    ///
    /// The caller is responsible for releasing the `AHardwareBuffer` pointer by calling
    /// `AHardwareBuffer_release` when it is finished with it, or may convert it back to a Rust
    /// `HardwareBuffer` by calling [`HardwareBuffer::from_raw`].
    pub fn into_raw(self) -> NonNull<AHardwareBuffer> {
        let buffer = ManuallyDrop::new(self);
        buffer.0