mailbox

package
v3.0.0-beta.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package mailbox provides asynchronous FIFO message processing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mailbox

type Mailbox[T any] struct {
	// contains filtered or unexported fields
}

Mailbox processes messages in send order without blocking senders on the consumer. The queue is unbounded and safe for concurrent senders.

func New

func New[T any](consume func(T)) *Mailbox[T]

New returns a mailbox that calls consume for one message at a time.

func (*Mailbox[T]) Send

func (m *Mailbox[T]) Send(message T)

Send adds message to the mailbox and starts a worker when the queue was idle.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL