routing::component_instance

Trait ComponentInstanceInterface

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

Show 14 methods // Required methods fn child_moniker(&self) -> Option<&ChildName>; 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; fn component_sandbox<'life0, 'async_trait>( self: &'life0 Arc<Self>, ) -> Pin<Box<dyn Future<Output = Result<ComponentSandbox, ComponentInstanceError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn as_weak(self: &Arc<Self>) -> WeakComponentInstanceInterface<Self> { ... } fn find_extended_instance<'life0, 'life1, 'async_trait>( self: &'life0 Arc<Self>, moniker: &'life1 ExtendedMoniker, ) -> Pin<Box<dyn Future<Output = Result<ExtendedInstanceInterface<Self>, ComponentInstanceError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn find_absolute<'life0, 'life1, 'async_trait>( self: &'life0 Arc<Self>, target_moniker: &'life1 Moniker, ) -> Pin<Box<dyn Future<Output = Result<Arc<Self>, ComponentInstanceError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn find_above_root( self: &Arc<Self>, ) -> Result<Arc<Self::TopInstance>, ComponentInstanceError> { ... }
}
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 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.

Source

fn component_sandbox<'life0, 'async_trait>( self: &'life0 Arc<Self>, ) -> Pin<Box<dyn Future<Output = Result<ComponentSandbox, ComponentInstanceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns a clone of this component’s sandbox. This may resolve the component if necessary.

Provided Methods§

Source

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

Returns a new WeakComponentInstanceInterface<Self> pointing to self.

Source

fn find_extended_instance<'life0, 'life1, 'async_trait>( self: &'life0 Arc<Self>, moniker: &'life1 ExtendedMoniker, ) -> Pin<Box<dyn Future<Output = Result<ExtendedInstanceInterface<Self>, ComponentInstanceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempts to walk the component tree (up and/or down) from the current component to find the extended instance represented by the given extended moniker. Intermediate components will be resolved as needed. Functionally this calls into find_absolute or find_above_root depending on the extended moniker.

Source

fn find_absolute<'life0, 'life1, 'async_trait>( self: &'life0 Arc<Self>, target_moniker: &'life1 Moniker, ) -> Pin<Box<dyn Future<Output = Result<Arc<Self>, ComponentInstanceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Attempts to walk the component tree (up and/or down) from the current component to find the component instance represented by the given moniker. Intermediate components will be resolved as needed.

Source

fn find_above_root( self: &Arc<Self>, ) -> Result<Arc<Self::TopInstance>, ComponentInstanceError>

Attempts to walk the component tree up to the above root instance. Intermediate components will be resolved as needed.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§