/// Set a particular set of system components
///
/// In particular, this allows exchanging the default dispatcher for the
/// [NetworkDispatcher](prelude::NetworkDispatcher), which enables the created Kompact system
/// to perform network communication.
///
/// # Example
///
/// For using the network dispatcher, with the default deadletter box:
/// ```
/// use kompact::prelude::*;
///
/// let mut cfg = KompactConfig::new();
/// cfg.system_components(DeadletterBox::new, {
///     let net_config = NetworkConfig::new("127.0.0.1:0".parse().expect("Address should work"));
///     net_config.build()
/// });
/// let system = cfg.build().expect("KompactSystem");
/// # system.shutdown().expect("shutdown");
/// ```
Set a particular set of system components
In particular, this allows exchanging the default dispatcher for the
[NetworkDispatcher](prelude::NetworkDispatcher), which enables the created Kompact system
to perform network communication.
Set a particular set of system components In particular this allows exchanging the default dispatcher for the [ NetworkDispatcher ] ( prelude :: NetworkDispatcher ) which enables the created Kompact system to perform network communication .
pub fn system_components<B, C, FB, FC>(
        &mut self,
        deadletter_fn: FB,
        dispatcher_fn: FC,
    ) -> &mut Self
    where
        B: ComponentDefinition + ActorRaw<Message = Never> + Sized + 'static,
        C: ComponentDefinition
            + ActorRaw<Message = DispatchEnvelope>
            + Sized
            + 'static
            + Dispatcher,
        FB: Fn(KPromise<()>) -> B + 'static,
        FC: Fn(KPromise<()>) -> C + 'static,
    {
        let sb = move |system: &KompactSystem, dead_prom: KPromise<()>, disp_prom: KPromise<()>| {
            let deadletter_box = system.create_unsupervised(|| deadletter_fn(dead_prom));
            let dispatcher = system.create_unsupervised(|| dispatcher_fn(disp_prom));
            let cc = CustomComponents {
                deadletter_box,
                dispatcher,
            };
            Box::new(cc) as Box<dyn SystemComponents>
        };
        self.sc_builder = Rc::new(sb);
        self
    }
pub fn system_components < B , C , FB , FC > ( & mut self , deadletter_fn : FB , dispatcher_fn : FC , ) -> & mut Self where B : ComponentDefinition + ActorRaw < Message = Never > + Sized + ' static , C : ComponentDefinition + ActorRaw < Message = DispatchEnvelope > + Sized + ' static + Dispatcher , FB : Fn ( KPromise < ( ) > ) -> B + ' static , FC : Fn ( KPromise < ( ) > ) -> C + ' static , { let sb = move | system : & KompactSystem , dead_prom : KPromise < ( ) > , disp_prom : KPromise < ( ) > | { let deadletter_box = system . create_unsupervised ( | | deadletter_fn ( dead_prom ) ) ; let dispatcher = system . create_unsupervised ( | | dispatcher_fn ( disp_prom ) ) ; let cc = CustomComponents { deadletter_box , dispatcher , } ; Box :: new ( cc ) as Box < dyn SystemComponents > } ; self . sc_builder = Rc :: new ( sb ) ; self }
Set a particular set of system components
In particular, this allows exchanging the default dispatcher for the
[NetworkDispatcher](prelude::NetworkDispatcher), which enables the created Kompact system
to perform network communication.
Set a particular set of system components In particular this allows exchanging the default dispatcher for the [ NetworkDispatcher ] ( prelude :: NetworkDispatcher ) which enables the created Kompact system to perform network communication .
&mut self
deadletter_fn
FB
dispatcher_fn
FC
example
For using the network dispatcher, with the default deadletter box:
```
use kompact::prelude::*.

let mut cfg = KompactConfig::new();
cfg.system_components(DeadletterBox::new, {
let net_config = NetworkConfig::new("127.0.0.1:0".parse().expect("Address should work"));
net_config.build()
});
let system = cfg.build().expect("KompactSystem").
For using the network dispatcher with the default deadletter box : ` ` ` use kompact :: prelude :: * . let mut cfg = KompactConfig :: new () ; cfg . system_components ( DeadletterBox :: new { let net_config = NetworkConfig :: new ( " 127 . 0 . 0 . 1 : 0 " . parse () . expect ( " Address should work " )) ; net_config . build () } ) ; let system = cfg . build () . expect ( " KompactSystem " ) .
system.shutdown().expect("shutdown");
None