pub trait Join: Sized {
// Required method
fn join(&mut self, others: Box<[Self]>);
}Expand description
The Join trait is used for merging multiple instances of a context into one.
Join is typically used after parallel execution, where several contexts
(or partial results) must be combined back into a single instance.
This trait complements Fork, enabling a fork-join lifecycle for contexts.
§Examples
use node_flow::context::Join;
struct Sum(usize);
impl Join for Sum {
fn join(&mut self, others: Box<[Self]>) {
for other in others {
self.0 += other.0;
}
}
}
let mut total = Sum(5);
total.join(Box::new([Sum(2), Sum(3)]));
assert_eq!(total.0, 10);Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl Join for LocalStorageImpl
Available on crate feature
local_storage_impl only.