2 releases

0.1.1 Sep 16, 2021
0.1.0 Dec 18, 2019

#9 in #ability

Download history 87/week @ 2024-07-26 75/week @ 2024-08-02 47/week @ 2024-08-09 80/week @ 2024-08-16 136/week @ 2024-08-23 31/week @ 2024-08-30 18/week @ 2024-09-06 22/week @ 2024-09-13 32/week @ 2024-09-20 59/week @ 2024-09-27 109/week @ 2024-10-04 78/week @ 2024-10-11 43/week @ 2024-10-18 97/week @ 2024-10-25 155/week @ 2024-11-01 87/week @ 2024-11-08

388 downloads per month

MIT/Apache

14KB
218 lines

mitosis

Build Status Current Version License: MIT/Apache-2.0

"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