diff options
author | 2025-02-07 19:26:04 +0000 | |
---|---|---|
committer | 2025-02-10 22:36:37 +0000 | |
commit | 75a50460e28bcf386dc6515906e2b43fded9566f (patch) | |
tree | f205209d086b52ddbd4542b9f214f624dde923e3 /libs/binder | |
parent | 69f67e7ee21a67868f16881c82ab9425bbe3e43c (diff) |
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
Diffstat (limited to 'libs/binder')
-rw-r--r-- | libs/binder/rust/src/binder.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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 { |