pub fn init()Expand description
Initializes procspawn.
This function must be called at the beginning of main. Whatever comes
before it is also executed for all processes spawned through the spawn
function.
For more complex initializations see ProcConfig.
Examples found in repository?
More examples
examples/macro.rs (line 4)
3fn main() {
4 procspawn::init();
5
6 let a = 42u32;
7 let b = 23u32;
8 let c = 1;
9 let handle = spawn!((a => new_name1, b, mut c) || -> Result<_, ()> {
10 c += 1;
11 Ok(new_name1 + b + c)
12 });
13 let value = handle.join().unwrap();
14
15 println!("{:?}", value);
16}examples/custom-serialization.rs (line 72)
71fn main() {
72 procspawn::init();
73
74 let bytes = MyBytes::open("Cargo.toml").unwrap();
75
76 let bytes_two = procspawn::spawn!((bytes.clone() => bytes) || {
77 println!("length: {}", bytes.bytes.len());
78 bytes
79 })
80 .join()
81 .unwrap();
82
83 assert_eq!(bytes, bytes_two);
84}Additional examples can be found in: