libbinder_rs: Add enum_values function to AIDL enums

This auto-generates an enum_values function for all
Rust AIDL enums that works very similarly to enum_range()
in C++.

Bug: 179438017
Test: m
Change-Id: Ice74682dc9e1119aca2a932c3d5644665963dad8
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs
index f79b1b7..dd0c7b8 100644
--- a/libs/binder/rust/src/binder.rs
+++ b/libs/binder/rust/src/binder.rs
@@ -897,7 +897,7 @@
 #[macro_export]
 macro_rules! declare_binder_enum {
     {
-        $enum:ident : $backing:ty {
+        $enum:ident : [$backing:ty; $size:expr] {
             $( $name:ident = $value:expr, )*
         }
     } => {
@@ -905,6 +905,11 @@
         pub struct $enum(pub $backing);
         impl $enum {
             $( pub const $name: Self = Self($value); )*
+
+            #[inline(always)]
+            pub const fn enum_values() -> [Self; $size] {
+                [$(Self::$name),*]
+            }
         }
 
         impl $crate::parcel::Serialize for $enum {