pub struct SIBinder { /* private fields */ }Expand description
Strong reference to a binder object.
Implementations§
Source§impl SIBinder
impl SIBinder
Sourcepub fn new(data: Arc<dyn IBinder>) -> Result<Self>
pub fn new(data: Arc<dyn IBinder>) -> Result<Self>
Wrap an Arc<dyn IBinder> in an SIBinder.
Drives inc_strong on the inner binder. For native binders this
advances the local RefCounter.strong; for proxies it is a no-op
(proxy ref-count is owned by the cache-pin model — see
proxy::ProxyHandle).
Sourcepub fn downgrade(this: &Self) -> WIBinder
pub fn downgrade(this: &Self) -> WIBinder
Construct a weak reference to this binder.
Pure Arc::downgrade — no kernel command, no trait dispatch.
For proxies, the resulting WIBinder snapshots (handle, stability, generation) so a later WIBinder::upgrade() can
route through the process-wide proxy cache. As long as the
cache pin is alive (no obituary yet), upgrade() succeeds via
case-(b) resurrection — matching Android wp<BpBinder>::promote()
semantics. If the cache entry was removed (obituary) or the
handle id was recycled to a different binder_node (generation
mismatch), upgrade() returns Err(DeadObject).
For native binders, the WIBinder is a plain
sync::Weak<dyn IBinder> — upgrade() succeeds iff some
Arc<dyn IBinder> to the inner binder is still alive.
Sourcepub fn stability(&self) -> Stability
pub fn stability(&self) -> Stability
Retrieve the stability level of the underlying binder object.
Sourcepub fn into_interface<I: FromIBinder + Interface + ?Sized>(
self,
) -> Result<Strong<I>>
pub fn into_interface<I: FromIBinder + Interface + ?Sized>( self, ) -> Result<Strong<I>>
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::BadType is returned.
Methods from Deref<Target = dyn IBinder>§
Sourcepub fn as_proxy(&self) -> Option<&ProxyHandle>
pub fn as_proxy(&self) -> Option<&ProxyHandle>
Convert this binder object into a proxy binder object.
Trait Implementations§
Source§impl Deserialize for SIBinder
impl Deserialize for SIBinder
Source§impl DeserializeArray for SIBinder
impl DeserializeArray for SIBinder
Source§impl DeserializeOption for SIBinder
impl DeserializeOption for SIBinder
Source§impl SerializeArray for SIBinder
impl SerializeArray for SIBinder
Source§impl SerializeOption for SIBinder
impl SerializeOption for SIBinder
impl Eq for SIBinder
Auto Trait Implementations§
impl Freeze for SIBinder
impl !RefUnwindSafe for SIBinder
impl Send for SIBinder
impl Sync for SIBinder
impl Unpin for SIBinder
impl UnsafeUnpin for SIBinder
impl !UnwindSafe for SIBinder
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§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§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.Source§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.