Skip to main content

adapt_many

Macro adapt_many 

Source
macro_rules! adapt_many {
    ([$($neuron:expr),+ $(,)?], $ganglion:expr $(,)?) => { ... };
    ([$($neuron:expr),+ $(,)?], $head_ganglion:expr, $($tail_ganglion:expr),+ $(,)?) => { ... };
}
Expand description

Macro to adapt multiple neurons to multiple heterogeneous ganglia at once.

This locks each ganglion once and adapts all provided neurons to it.

ยงExamples

let ns = Arc::new(NamespaceImpl { delimiter: ".", parts: vec!["test"] });
let n1 = Arc::new(NeuronImpl::<Dummy, Dummy>::new(ns.clone()));
let n2 = Arc::new(NeuronImpl::<Dummy, Dummy>::new(ns));
let g1 = Arc::new(Mutex::new(GanglionInprocess::new()));
let g2 = Arc::new(Mutex::new(GanglionInprocess::new()));

let res: Result<(), plexor_core::ganglion::GanglionError> = adapt_many!([n1, n2], g1, g2).await;
res.unwrap();