[][src]Function kompact::prelude::biconnect_components

pub fn biconnect_components<P, C1, C2>(
    provider: &Arc<Component<C1>>,
    requirer: &Arc<Component<C2>>
) -> Result<(), TryDualLockError> where
    P: Port + 'static,
    C1: ComponentDefinition + Sized + 'static + Provide<P> + ProvideRef<P>,
    C2: ComponentDefinition + Sized + 'static + Require<P> + RequireRef<P>, 

Connect two components on their instances of port type P.

The component providing the port must be given as first argument, and the requiring component second.

This function can fail with a TryDualLockError, if one of the mutexes can not be acquired immediately.

Example

use kompact::prelude::*;


let system = KompactConfig::default().build().expect("system");
let c1 = system.create(TestComponent1::new);
let c2 = system.create(TestComponent2::new);
biconnect_components::<TestPort,_,_>(&c1, &c2).expect("connection");