pub trait ComponentInstanceInterface: Sized + Send + Sync {
    type TopInstance: TopInstanceInterface + Send + Sync;

    // Required methods
    fn child_moniker(&self) -> Option<&ChildName>;
    fn instanced_moniker(&self) -> &InstancedMoniker;
    fn moniker(&self) -> &Moniker;
    fn url(&self) -> &Url;
    fn environment(&self) -> &Environment<Self>;
    fn config_parent_overrides(&self) -> Option<&Vec<ConfigOverride>>;
    fn policy_checker(&self) -> &GlobalPolicyChecker;
    fn component_id_index(&self) -> &Index;
    fn try_get_parent(
        &self
    ) -> Result<ExtendedInstanceInterface<Self>, ComponentInstanceError>;
    fn lock_resolved_state<'a, 'async_trait>(
        self: &'a Arc<Self>
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ResolvedInstanceInterface<Component = Self> + 'a>, ComponentInstanceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;

    // Provided method
    fn as_weak(self: &Arc<Self>) -> WeakComponentInstanceInterface<Self> { ... }
}
Expand description

A trait providing a representation of a component instance.

Required Associated Types§

Required Methods§

source

fn child_moniker(&self) -> Option<&ChildName>

Returns this ComponentInstanceInterface’s child moniker, if it is not the root instance.

source

fn instanced_moniker(&self) -> &InstancedMoniker

Returns this ComponentInstanceInterface’s instanced moniker

source

fn moniker(&self) -> &Moniker

Returns this ComponentInstanceInterface’s moniker.

source

fn url(&self) -> &Url

Returns this ComponentInstanceInterface’s component URL.

source

fn environment(&self) -> &Environment<Self>

Returns a representation of this ComponentInstanceInterface’s environment.

source

fn config_parent_overrides(&self) -> Option<&Vec<ConfigOverride>>

Returns configuration overrides applied to this component by its parent.

source

fn policy_checker(&self) -> &GlobalPolicyChecker

Returns the GlobalPolicyChecker for this component instance.

source

fn component_id_index(&self) -> &Index

Returns the component ID index for this component instance.

source

fn try_get_parent( &self ) -> Result<ExtendedInstanceInterface<Self>, ComponentInstanceError>

Gets the parent, if it still exists, or returns an InstanceNotFound error.

source

fn lock_resolved_state<'a, 'async_trait>( self: &'a Arc<Self> ) -> Pin<Box<dyn Future<Output = Result<Box<dyn ResolvedInstanceInterface<Component = Self> + 'a>, ComponentInstanceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Locks and returns a lazily-resolved and populated ResolvedInstanceInterface. Returns an InstanceNotFound error if the instance is destroyed. The instance will remain locked until the result is dropped.

NOTE: The Box<dyn> in the return type is necessary, because the type of the result depends on the lifetime of the self reference. The proposed “generic associated types” feature would let us define this statically.

Provided Methods§

source

fn as_weak(self: &Arc<Self>) -> WeakComponentInstanceInterface<Self>

Returns a new WeakComponentInstanceInterface<Self> pointing to self.

Object Safety§

This trait is not object safe.

Implementors§