libbinder_rs: Add support for attributes to declare_binder_enum
Enums can be deprecated in AIDL. In order to support this, the
declare_binder_enum macro needs to support adding attributes to the
declared enum inside the macro.
Test: atest rustBinderTest
Bug: 177860423
Change-Id: I6f210f02b45b4647d65e93c3333f25afc1bd06c3
diff --git a/libs/binder/rust/src/binder.rs b/libs/binder/rust/src/binder.rs
index bd2e695..c31de31 100644
--- a/libs/binder/rust/src/binder.rs
+++ b/libs/binder/rust/src/binder.rs
@@ -1024,16 +1024,20 @@
#[macro_export]
macro_rules! declare_binder_enum {
{
+ $( #[$attr:meta] )*
$enum:ident : [$backing:ty; $size:expr] {
$( $name:ident = $value:expr, )*
}
} => {
+ $( #[$attr] )*
#[derive(Debug, Default, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
+ #[allow(missing_docs)]
pub struct $enum(pub $backing);
impl $enum {
- $( pub const $name: Self = Self($value); )*
+ $( #[allow(missing_docs)] pub const $name: Self = Self($value); )*
#[inline(always)]
+ #[allow(missing_docs)]
pub const fn enum_values() -> [Self; $size] {
[$(Self::$name),*]
}