pub struct SpIBinder(/* private fields */);
Expand description
A strong reference to a Binder remote object.
This struct encapsulates the generic C++ sp<IBinder>
class. This wrapper
is untyped; typed interface access is implemented by the AIDL compiler.
Implementations§
Source§impl SpIBinder
impl SpIBinder
Sourcepub unsafe fn as_raw(&self) -> *mut AIBinder
pub unsafe fn as_raw(&self) -> *mut AIBinder
Extract a raw AIBinder
pointer from this wrapper.
This method should only be used for testing. Do not try to use the NDK interface directly for anything else.
§Safety
The resulting pointer is valid only as long as the SpIBinder is alive. The SpIBinder object retains ownership of the AIBinder and the caller should not attempt to free the returned pointer.
Sourcepub fn is_remote(&self) -> bool
pub fn is_remote(&self) -> bool
Return true if this binder object is hosted in a different process than the current one.
Sourcepub fn into_interface<I: FromIBinder + Interface + ?Sized>(
self,
) -> Result<Strong<I>, StatusCode>
pub fn into_interface<I: FromIBinder + Interface + ?Sized>( self, ) -> Result<Strong<I>, StatusCode>
Try to convert this Binder object into a trait object for the given Binder interface.
If this object does not implement the expected interface, the error
StatusCode::BAD_TYPE
is returned.
Sourcepub fn get_class(&mut self) -> Option<InterfaceClass>
pub fn get_class(&mut self) -> Option<InterfaceClass>
Return the interface class of this binder object, if associated with one.
Trait Implementations§
Source§impl AssociateClass for SpIBinder
impl AssociateClass for SpIBinder
Source§fn associate_class(&mut self, class: InterfaceClass) -> bool
fn associate_class(&mut self, class: InterfaceClass) -> bool
I
. Read moreSource§impl Deserialize for SpIBinder
impl Deserialize for SpIBinder
Source§type UninitType = Option<SpIBinder>
type UninitType = Option<SpIBinder>
Self
if the type implements Default
, Option<Self>
otherwise.Source§fn uninit() -> Self::UninitType
fn uninit() -> Self::UninitType
Source§fn from_init(value: Self) -> Self::UninitType
fn from_init(value: Self) -> Self::UninitType
Self
into Self::UninitType
.Source§fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<SpIBinder, StatusCode>
fn deserialize(parcel: &BorrowedParcel<'_>) -> Result<SpIBinder, StatusCode>
crate::parcel::Parcel
.Source§const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _
const ASSERT_UNINIT_SIZE_AND_ALIGNMENT: bool = _
Self
and Self::UninitType
have the same
size and alignment. This will either fail to compile or evaluate to true
.
The only two macros that work here are panic!
and assert!
, so we cannot
use assert_eq!
.Source§fn deserialize_from(
&mut self,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn deserialize_from( &mut self, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
crate::parcel::Parcel
onto the
current object. This operation will overwrite the old value
partially or completely, depending on how much data is available.Source§impl DeserializeArray for SpIBinder
impl DeserializeArray for SpIBinder
Source§fn deserialize_array(
parcel: &BorrowedParcel<'_>,
) -> Result<Option<Vec<Self>>, StatusCode>
fn deserialize_array( parcel: &BorrowedParcel<'_>, ) -> Result<Option<Vec<Self>>, StatusCode>
Source§impl DeserializeOption for SpIBinder
impl DeserializeOption for SpIBinder
Source§fn deserialize_option(
parcel: &BorrowedParcel<'_>,
) -> Result<Option<SpIBinder>, StatusCode>
fn deserialize_option( parcel: &BorrowedParcel<'_>, ) -> Result<Option<SpIBinder>, StatusCode>
Source§fn deserialize_option_from(
this: &mut Option<Self>,
parcel: &BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn deserialize_option_from( this: &mut Option<Self>, parcel: &BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§impl Ord for SpIBinder
impl Ord for SpIBinder
Source§impl PartialOrd for SpIBinder
impl PartialOrd for SpIBinder
Source§impl Serialize for SpIBinder
impl Serialize for SpIBinder
Source§fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>
fn serialize(&self, parcel: &mut BorrowedParcel<'_>) -> Result<(), StatusCode>
crate::parcel::Parcel
.Source§impl SerializeArray for SpIBinder
impl SerializeArray for SpIBinder
Source§fn serialize_array(
slice: &[Self],
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn serialize_array( slice: &[Self], parcel: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§impl SerializeOption for SpIBinder
impl SerializeOption for SpIBinder
Source§fn serialize_option(
this: Option<&Self>,
parcel: &mut BorrowedParcel<'_>,
) -> Result<(), StatusCode>
fn serialize_option( this: Option<&Self>, parcel: &mut BorrowedParcel<'_>, ) -> Result<(), StatusCode>
Source§impl<B: Remotable> TryFrom<SpIBinder> for Binder<B>
impl<B: Remotable> TryFrom<SpIBinder> for Binder<B>
Source§type Error = android_c_interface_StatusCode
type Error = android_c_interface_StatusCode
impl Eq for SpIBinder
impl Send for SpIBinder
Safety: An SpIBinder
is an immutable handle to a C++ IBinder, which is
thread-safe.
impl Sync for SpIBinder
Safety: An SpIBinder
is an immutable handle to a C++ IBinder, which is
thread-safe.
Auto Trait Implementations§
impl Freeze for SpIBinder
impl RefUnwindSafe for SpIBinder
impl Unpin for SpIBinder
impl UnwindSafe for SpIBinder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IBinder for Twhere
T: AsNative<AIBinder>,
impl<T> IBinder for Twhere
T: AsNative<AIBinder>,
Source§fn link_to_death(
&mut self,
recipient: &mut DeathRecipient,
) -> Result<(), android_c_interface_StatusCode>
fn link_to_death( &mut self, recipient: &mut DeathRecipient, ) -> Result<(), android_c_interface_StatusCode>
DeathRecipient
’s callback will be called. Read moreSource§fn unlink_to_death(
&mut self,
recipient: &mut DeathRecipient,
) -> Result<(), android_c_interface_StatusCode>
fn unlink_to_death( &mut self, recipient: &mut DeathRecipient, ) -> Result<(), android_c_interface_StatusCode>
Source§fn ping_binder(&mut self) -> Result<(), android_c_interface_StatusCode>
fn ping_binder(&mut self) -> Result<(), android_c_interface_StatusCode>
Source§impl<T> IBinderInternal for Twhere
T: AsNative<AIBinder>,
impl<T> IBinderInternal for Twhere
T: AsNative<AIBinder>,
Source§fn prepare_transact(&self) -> Result<Parcel, android_c_interface_StatusCode>
fn prepare_transact(&self) -> Result<Parcel, android_c_interface_StatusCode>
submit_transact
.Source§fn submit_transact(
&self,
code: u32,
data: Parcel,
flags: u32,
) -> Result<Parcel, android_c_interface_StatusCode>
fn submit_transact( &self, code: u32, data: Parcel, flags: u32, ) -> Result<Parcel, android_c_interface_StatusCode>
Source§fn is_binder_alive(&self) -> bool
fn is_binder_alive(&self) -> bool
Source§fn set_requesting_sid(&mut self, enable: bool)
fn set_requesting_sid(&mut self, enable: bool)
Source§fn dump<F>(
&mut self,
fp: &F,
args: &[&str],
) -> Result<(), android_c_interface_StatusCode>where
F: AsRawFd,
fn dump<F>(
&mut self,
fp: &F,
args: &[&str],
) -> Result<(), android_c_interface_StatusCode>where
F: AsRawFd,
Source§fn get_extension(
&mut self,
) -> Result<Option<SpIBinder>, android_c_interface_StatusCode>
fn get_extension( &mut self, ) -> Result<Option<SpIBinder>, android_c_interface_StatusCode>
Source§fn transact<F: FnOnce(BorrowedParcel<'_>) -> Result<(), StatusCode>>(
&self,
code: TransactionCode,
flags: TransactionFlags,
input_callback: F,
) -> Result<Parcel, StatusCode>
fn transact<F: FnOnce(BorrowedParcel<'_>) -> Result<(), StatusCode>>( &self, code: TransactionCode, flags: TransactionFlags, input_callback: F, ) -> Result<Parcel, StatusCode>
prepare_transact
followed by
`submit_transact. Read more