2 releases

0.1.1 Sep 16, 2021
0.1.0 Dec 18, 2019

#6 in #ability

Download history 9/week @ 2024-02-15 19/week @ 2024-02-22 15/week @ 2024-02-29 41/week @ 2024-03-07 20/week @ 2024-03-14 27/week @ 2024-03-21 68/week @ 2024-03-28 74/week @ 2024-04-04 32/week @ 2024-04-11

202 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

~5–16MB
~217K SLoC