2 releases

0.1.1 Sep 16, 2021
0.1.0 Dec 18, 2019

#11 in #ability

Download history 50/week @ 2024-11-13 34/week @ 2024-11-20 40/week @ 2024-11-27 31/week @ 2024-12-04 113/week @ 2024-12-11 212/week @ 2024-12-18 50/week @ 2024-12-25 153/week @ 2025-01-01 126/week @ 2025-01-08 30/week @ 2025-01-15 57/week @ 2025-01-29 80/week @ 2025-02-05 96/week @ 2025-02-12 104/week @ 2025-02-19 65/week @ 2025-02-26

362 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–16MB
~239K SLoC