2 releases
0.1.1 | Sep 16, 2021 |
---|---|
0.1.0 | Dec 18, 2019 |
#9 in #ability
388 downloads per month
14KB
218 lines
mitosis
"AWS Lambda for your local machine"
-- @jdm
This crate provides mitosis::spawn()
, which is similar to thread::spawn()
but will spawn a new process instead.
fn main() {
// Needs to be near the beginning of your program
mitosis::init();
// some code
let some_data = 5;
mitosis::spawn(some_data, |data| {
println!("hello from another process, your data is {}", data);
});
}
lib.rs
:
This crate provides the ability to spawn processes with a function similar
to thread::spawn
To use this crate, call mitosis::init()
at the beginning of your main()
,
and then anywhere in your program you may call mitosis::spawn()
:
let data = vec![1, 2, 3, 4];
mitosis::spawn(data, |data| {
// This will run in a separate process
println!("Received data {:?}", data);
});
mitosis::spawn()
can pass arbitrary serializable data, including IPC senders
and receivers from the ipc-channel
crate, down to the new process.
Dependencies
~6–15MB
~227K SLoC