#synchronization #sync #messages

messaging

A simple two-way messaging crate

7 releases (stable)

1.0.6 Jan 22, 2024
0.1.0 Jan 22, 2024

#503 in Data structures

42 downloads per month

MIT/Apache

7KB

A simple two-way messaging crate

ko-fi

Good for use cases such as communication across two threads.

let (renderer_mailbox, game_mailbox) = Mailbox::new_entangled_pair();

renderer_mailbox.send(RenderLoopMessage::SyncWithGame);
if let Ok(RenderLoopMessage::SyncWithGame) = game_mailbox.poll() {
    // ...
}

game_mailbox.send_and_wait(GameLoopMessage::SyncWithRender)?;

Dependencies

~300–760KB
~18K SLoC