pub trait AnyComponent:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn as_any_arc(&self) -> Arc<dyn Any + Send + Sync> ⓘ;
fn start(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>;
fn stop(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>;
fn health(&self) -> BoxFuture<'_, HealthStatus>;
fn pre_replace(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>;
fn post_replace(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>;
}Expand description
Object-safe view of a Component instance, used by the registry to
store and drive components of heterogeneous types uniformly.
Required Methods§
Sourcefn as_any_arc(&self) -> Arc<dyn Any + Send + Sync> ⓘ
fn as_any_arc(&self) -> Arc<dyn Any + Send + Sync> ⓘ
Underlying concrete type, used by ComponentRegistry::get to
downcast back to a concrete Arc<C>. Returns a type-erased
Arc<dyn Any> clone of the typed instance.
Sourcefn start(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
fn start(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
Begin serving. See Component::start.
Sourcefn stop(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
fn stop(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
Stop serving. See Component::stop.
Sourcefn health(&self) -> BoxFuture<'_, HealthStatus>
fn health(&self) -> BoxFuture<'_, HealthStatus>
Health probe. See Component::health.
Sourcefn pre_replace(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
fn pre_replace(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
Called before this component is replaced. See
Component::pre_replace_hook.
Sourcefn post_replace(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
fn post_replace(&self) -> BoxFuture<'_, Result<(), AnyComponentError>>
Called after this component has been replaced. See
Component::post_replace_hook.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".