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§
type TopInstance: TopInstanceInterface + Send + Sync
Required Methods§
sourcefn child_moniker(&self) -> Option<&ChildName>
fn child_moniker(&self) -> Option<&ChildName>
Returns this ComponentInstanceInterface
’s child moniker, if it is
not the root instance.
sourcefn instanced_moniker(&self) -> &InstancedMoniker
fn instanced_moniker(&self) -> &InstancedMoniker
Returns this ComponentInstanceInterface
’s instanced moniker
sourcefn environment(&self) -> &Environment<Self>
fn environment(&self) -> &Environment<Self>
Returns a representation of this ComponentInstanceInterface
’s environment.
sourcefn config_parent_overrides(&self) -> Option<&Vec<ConfigOverride>>
fn config_parent_overrides(&self) -> Option<&Vec<ConfigOverride>>
Returns configuration overrides applied to this component by its parent.
sourcefn policy_checker(&self) -> &GlobalPolicyChecker
fn policy_checker(&self) -> &GlobalPolicyChecker
Returns the GlobalPolicyChecker
for this component instance.
sourcefn component_id_index(&self) -> &Index
fn component_id_index(&self) -> &Index
Returns the component ID index for this component instance.
sourcefn try_get_parent(
&self
) -> Result<ExtendedInstanceInterface<Self>, ComponentInstanceError>
fn try_get_parent( &self ) -> Result<ExtendedInstanceInterface<Self>, ComponentInstanceError>
Gets the parent, if it still exists, or returns an InstanceNotFound
error.
sourcefn 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,
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§
sourcefn as_weak(self: &Arc<Self>) -> WeakComponentInstanceInterface<Self>
fn as_weak(self: &Arc<Self>) -> WeakComponentInstanceInterface<Self>
Returns a new WeakComponentInstanceInterface<Self>
pointing to self
.