pub trait SystemComponents:
Send
+ Sync
+ 'static {
// Required methods
fn deadletter_ref(&self) -> ActorRef<!>;
fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>;
fn system_path(&self) -> SystemPath;
fn start(&self, _system: &KompactSystem);
fn stop(&self, _system: &KompactSystem);
fn stop_notify<'a>(
&'a self,
system: &'a KompactSystem,
) -> Pin<Box<dyn Future<Output = Result<(), SystemComponentsShutdownError>> + Send + 'a>>;
fn kill(&self, _system: &KompactSystem);
fn with_dispatcher_definition_dyn<'a>(
&self,
f: Box<dyn FnOnce(&mut (dyn Any + 'static)) + 'a>,
);
// Provided methods
fn type_id(&self) -> TypeId { ... }
fn with_dispatcher_definition<F>(&self, f: F)
where Self: Sized,
F: FnOnce(&mut (dyn Any + 'static)) { ... }
}Expand description
A trait to provide custom implementations of all system components
Required Methods§
Sourcefn deadletter_ref(&self) -> ActorRef<!>
fn deadletter_ref(&self) -> ActorRef<!>
Return a reference to this deadletter box
Sourcefn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>
fn dispatcher_ref(&self) -> ActorRefStrong<DispatchEnvelope>
Return a reference to this dispatcher
Sourcefn system_path(&self) -> SystemPath
fn system_path(&self) -> SystemPath
Return a system path for this dispatcher
Sourcefn start(&self, _system: &KompactSystem)
fn start(&self, _system: &KompactSystem)
Start all the system components
Sourcefn stop(&self, _system: &KompactSystem)
fn stop(&self, _system: &KompactSystem)
Stop all the system components
Sourcefn stop_notify<'a>(
&'a self,
system: &'a KompactSystem,
) -> Pin<Box<dyn Future<Output = Result<(), SystemComponentsShutdownError>> + Send + 'a>>
fn stop_notify<'a>( &'a self, system: &'a KompactSystem, ) -> Pin<Box<dyn Future<Output = Result<(), SystemComponentsShutdownError>> + Send + 'a>>
Stop all the system components and complete once shutdown has finished
Sourcefn kill(&self, _system: &KompactSystem)
fn kill(&self, _system: &KompactSystem)
Stop all the system components as fast as possible, no graceful shutdown
Sourcefn with_dispatcher_definition_dyn<'a>(
&self,
f: Box<dyn FnOnce(&mut (dyn Any + 'static)) + 'a>,
)
fn with_dispatcher_definition_dyn<'a>( &self, f: Box<dyn FnOnce(&mut (dyn Any + 'static)) + 'a>, )
Allow backend crates to interact with the concrete dispatcher definition.
This takes a boxed callback instead of impl FnOnce(...), because
SystemComponents is used behind a trait object and generic methods would
make the trait non-object-safe.
Provided Methods§
Sourcefn with_dispatcher_definition<F>(&self, f: F)
fn with_dispatcher_definition<F>(&self, f: F)
Convenience wrapper for callers that work with a concrete system-components type.
Implementations§
Source§impl dyn SystemComponents
impl dyn SystemComponents
Sourcepub fn downcast<T>(&self) -> Option<&T>where
T: SystemComponents,
pub fn downcast<T>(&self) -> Option<&T>where
T: SystemComponents,
Allow downcasting to concrete type