Module mailbox

Module mailbox 

Source
Expand description

Mailbox-based message passing for safe cross-thread communication.

This module provides a Mailbox type that enables asynchronous message passing to a value owned by a background task. The mailbox ensures thread-safe access to the contained value by serializing all operations through a message queue.

§Overview

The mailbox pattern is useful when you need to:

  • Share mutable state across threads safely
  • Process operations on a value sequentially
  • Avoid blocking when sending updates
  • Make async calls that return values

Structs§

Mailbox
A mailbox for sending messages to a value owned by a background task.