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

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

Merge "rust: Fix Debug implementation for declare_binder_enum!" am: 0629658d...

Merge "rust: Fix Debug implementation for declare_binder_enum!" am: 0629658d am: 32963aca am: 10f0616b

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



Change-Id: Ief509e5ffc6118a32f166143e1adebcc09a8efc5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6335f79b 10f0616b
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -1091,7 +1091,7 @@ macro_rules! declare_binder_enum {
        }
    } => {
        $( #[$attr] )*
        #[derive(Debug, Default, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
        #[derive(Default, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
        #[allow(missing_docs)]
        pub struct $enum(pub $backing);
        impl $enum {
@@ -1104,6 +1104,15 @@ macro_rules! declare_binder_enum {
            }
        }

        impl std::fmt::Debug for $enum {
            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
                match self.0 {
                    $($value => f.write_str(stringify!($name)),)*
                    _ => f.write_fmt(format_args!("{}", self.0))
                }
            }
        }

        impl $crate::binder_impl::Serialize for $enum {
            fn serialize(&self, parcel: &mut $crate::binder_impl::BorrowedParcel<'_>) -> std::result::Result<(), $crate::StatusCode> {
                parcel.write(&self.0)