Loading libs/binder/rust/src/lib.rs +1 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ pub mod public_api { pub use super::parcel::ParcelFileDescriptor; pub use super::{add_service, get_interface}; pub use super::{ ExceptionCode, Interface, ProcessState, SpIBinder, Status, StatusCode, ExceptionCode, Interface, ProcessState, SpIBinder, Status, StatusCode, WpIBinder, }; /// Binder result containing a [`Status`] on error. Loading libs/binder/rust/src/proxy.rs +19 −4 Original line number Diff line number Diff line Loading @@ -102,6 +102,11 @@ impl SpIBinder { class.as_ref().map(|p| InterfaceClass::from_ptr(p)) } } /// Creates a new weak reference to this binder object. pub fn downgrade(&mut self) -> WpIBinder { WpIBinder::new(self) } } /// An object that can be associate with an [`InterfaceClass`]. Loading Loading @@ -370,15 +375,25 @@ impl DeserializeArray for Option<SpIBinder> {} /// A weak reference to a Binder remote object. /// /// This struct encapsulates the C++ `wp<IBinder>` class. However, this wrapper /// is untyped, so properly typed versions implementing a particular binder /// interface should be crated with [`declare_binder_interface!`]. /// This struct encapsulates the generic C++ `wp<IBinder>` class. This wrapper /// is untyped; typed interface access is implemented by the AIDL compiler. pub struct WpIBinder(*mut sys::AIBinder_Weak); impl fmt::Debug for WpIBinder { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("WpIBinder") } } /// # Safety /// /// A `WpIBinder` is a handle to a C++ IBinder, which is thread-safe. unsafe impl Send for WpIBinder {} impl WpIBinder { /// Create a new weak reference from an object that can be converted into a /// raw `AIBinder` pointer. pub fn new<B: AsNative<sys::AIBinder>>(binder: &mut B) -> WpIBinder { fn new<B: AsNative<sys::AIBinder>>(binder: &mut B) -> WpIBinder { let ptr = unsafe { // Safety: `SpIBinder` guarantees that `binder` always contains a // valid pointer to an `AIBinder`. Loading Loading
libs/binder/rust/src/lib.rs +1 −1 Original line number Diff line number Diff line Loading @@ -122,7 +122,7 @@ pub mod public_api { pub use super::parcel::ParcelFileDescriptor; pub use super::{add_service, get_interface}; pub use super::{ ExceptionCode, Interface, ProcessState, SpIBinder, Status, StatusCode, ExceptionCode, Interface, ProcessState, SpIBinder, Status, StatusCode, WpIBinder, }; /// Binder result containing a [`Status`] on error. Loading
libs/binder/rust/src/proxy.rs +19 −4 Original line number Diff line number Diff line Loading @@ -102,6 +102,11 @@ impl SpIBinder { class.as_ref().map(|p| InterfaceClass::from_ptr(p)) } } /// Creates a new weak reference to this binder object. pub fn downgrade(&mut self) -> WpIBinder { WpIBinder::new(self) } } /// An object that can be associate with an [`InterfaceClass`]. Loading Loading @@ -370,15 +375,25 @@ impl DeserializeArray for Option<SpIBinder> {} /// A weak reference to a Binder remote object. /// /// This struct encapsulates the C++ `wp<IBinder>` class. However, this wrapper /// is untyped, so properly typed versions implementing a particular binder /// interface should be crated with [`declare_binder_interface!`]. /// This struct encapsulates the generic C++ `wp<IBinder>` class. This wrapper /// is untyped; typed interface access is implemented by the AIDL compiler. pub struct WpIBinder(*mut sys::AIBinder_Weak); impl fmt::Debug for WpIBinder { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.pad("WpIBinder") } } /// # Safety /// /// A `WpIBinder` is a handle to a C++ IBinder, which is thread-safe. unsafe impl Send for WpIBinder {} impl WpIBinder { /// Create a new weak reference from an object that can be converted into a /// raw `AIBinder` pointer. pub fn new<B: AsNative<sys::AIBinder>>(binder: &mut B) -> WpIBinder { fn new<B: AsNative<sys::AIBinder>>(binder: &mut B) -> WpIBinder { let ptr = unsafe { // Safety: `SpIBinder` guarantees that `binder` always contains a // valid pointer to an `AIBinder`. Loading