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/tests/integration.rs b/libs/binder/rust/tests/integration.rs
index 1fd2ead..40359b4 100644
--- a/libs/binder/rust/tests/integration.rs
+++ b/libs/binder/rust/tests/integration.rs
@@ -16,7 +16,7 @@
//! Rust Binder crate integration tests
-use binder::declare_binder_interface;
+use binder::{declare_binder_enum, declare_binder_interface};
use binder::parcel::BorrowedParcel;
use binder::{
Binder, BinderFeatures, IBinderInternal, Interface, StatusCode, ThreadState, TransactionCode,
@@ -294,6 +294,23 @@
impl ITestSameDescriptor for Binder<BnTestSameDescriptor> {}
+declare_binder_enum! {
+ TestEnum : [i32; 3] {
+ FOO = 1,
+ BAR = 2,
+ BAZ = 3,
+ }
+}
+
+declare_binder_enum! {
+ #[deprecated(since = "1.0.0")]
+ TestDeprecatedEnum : [i32; 3] {
+ FOO = 1,
+ BAR = 2,
+ BAZ = 3,
+ }
+}
+
#[cfg(test)]
mod tests {
use selinux_bindgen as selinux_sys;