From 75a50460e28bcf386dc6515906e2b43fded9566f Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Fri, 7 Feb 2025 19:26:04 +0000 Subject: Add get() method to declare_binder_enum This returns the value of the enum as the backing type. Test: atest aidl_integration_test Bug: 393455995 Change-Id: Ic35021edfdabf59ce2017b91ee4f65953c071c70 --- libs/binder/rust/src/binder.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs') diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs index 6a8a69843a..771c65bf92 100644 --- a/libs/binder/rust/src/binder.rs +++ b/libs/binder/rust/src/binder.rs @@ -1160,6 +1160,12 @@ macro_rules! declare_binder_enum { pub const fn enum_values() -> [Self; $size] { [$(Self::$name),*] } + + #[inline(always)] + #[allow(missing_docs)] + pub const fn get(&self) -> $backing { + self.0 + } } impl std::fmt::Debug for $enum { -- cgit v1.2.3-59-g8ed1b