Loading libs/binder/rust/src/binder.rs +5 −1 Original line number Diff line number Diff line Loading @@ -1027,16 +1027,20 @@ macro_rules! declare_binder_interface { #[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),*] } Loading libs/binder/rust/tests/integration.rs +18 −1 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -294,6 +294,23 @@ impl ITestSameDescriptor for BpTestSameDescriptor {} 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; Loading Loading
libs/binder/rust/src/binder.rs +5 −1 Original line number Diff line number Diff line Loading @@ -1027,16 +1027,20 @@ macro_rules! declare_binder_interface { #[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),*] } Loading
libs/binder/rust/tests/integration.rs +18 −1 Original line number Diff line number Diff line Loading @@ -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, Loading Loading @@ -294,6 +294,23 @@ impl ITestSameDescriptor for BpTestSameDescriptor {} 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; Loading