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

Commit a43a2fab authored by Jooyung Han's avatar Jooyung Han Committed by Automerger Merge Worker
Browse files

libbinder_rs: PartialEq for ParcelFileDescriptor am: bbfe6b12 am: 90402518

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

Change-Id: I35280ef1d0f218d1a062bb8668fba0be50df70c8
parents b5c760a2 90402518
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -60,6 +60,16 @@ impl IntoRawFd for ParcelFileDescriptor {
    }
}

impl PartialEq for ParcelFileDescriptor {
    // Since ParcelFileDescriptors own the FD, if this function ever returns true (and it is used to
    // compare two different objects), then it would imply that an FD is double-owned.
    fn eq(&self, other: &Self) -> bool {
        self.as_raw_fd() == other.as_raw_fd()
    }
}

impl Eq for ParcelFileDescriptor {}

impl Serialize for ParcelFileDescriptor {
    fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<()> {
        let fd = self.0.as_raw_fd();