2 releases

0.1.1 Sep 16, 2021
0.1.0 Dec 18, 2019

#5 in #ability

Download history 234/week @ 2024-07-01 57/week @ 2024-07-08 27/week @ 2024-07-15 67/week @ 2024-07-22 75/week @ 2024-07-29 79/week @ 2024-08-05 47/week @ 2024-08-12 90/week @ 2024-08-19 117/week @ 2024-08-26 34/week @ 2024-09-02 9/week @ 2024-09-09 21/week @ 2024-09-16 65/week @ 2024-09-23 72/week @ 2024-09-30 120/week @ 2024-10-07 51/week @ 2024-10-14

309 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
~226K SLoC