pub struct WeakComponentInstanceInterface<C: ComponentInstanceInterface> {
pub moniker: Moniker,
/* private fields */
}
Expand description
A wrapper for a weak reference to a type implementing ComponentInstanceInterface
. Provides the
moniker of the component instance, which is useful for error reporting if the original
component instance has been destroyed.
Fields§
§moniker: Moniker
Implementations§
source§impl<C: ComponentInstanceInterface> WeakComponentInstanceInterface<C>
impl<C: ComponentInstanceInterface> WeakComponentInstanceInterface<C>
pub fn new(component: &Arc<C>) -> Self
sourcepub fn invalid() -> Self
pub fn invalid() -> Self
Returns a new weak component instance that will always fail to upgrade.
sourcepub fn upgrade(&self) -> Result<Arc<C>, ComponentInstanceError>
pub fn upgrade(&self) -> Result<Arc<C>, ComponentInstanceError>
Attempts to upgrade this WeakComponentInterface<C>
into an Arc<C>
, if the
original component instance interface C
has not been destroyed.
Trait Implementations§
source§impl<C: ComponentInstanceInterface> Clone for WeakComponentInstanceInterface<C>
impl<C: ComponentInstanceInterface> Clone for WeakComponentInstanceInterface<C>
source§impl<C: ComponentInstanceInterface> Debug for WeakComponentInstanceInterface<C>
impl<C: ComponentInstanceInterface> Debug for WeakComponentInstanceInterface<C>
source§impl<C: ComponentInstanceInterface> Default for WeakComponentInstanceInterface<C>
impl<C: ComponentInstanceInterface> Default for WeakComponentInstanceInterface<C>
source§impl<C: ComponentInstanceInterface> From<&Arc<C>> for WeakComponentInstanceInterface<C>
impl<C: ComponentInstanceInterface> From<&Arc<C>> for WeakComponentInstanceInterface<C>
Auto Trait Implementations§
impl<C> Freeze for WeakComponentInstanceInterface<C>
impl<C> RefUnwindSafe for WeakComponentInstanceInterface<C>
impl<C> Send for WeakComponentInstanceInterface<C>
impl<C> Sync for WeakComponentInstanceInterface<C>
impl<C> Unpin for WeakComponentInstanceInterface<C>
impl<C> UnwindSafe for WeakComponentInstanceInterface<C>
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
Mutably borrows from an owned value. Read more