Skip to main content

Module manager

Module manager 

Source
Expand description

Typed token-backed message storage.

This module defines MemoryManager, the core storage interface for managers that own complete Message<P> values and expose them through lightweight MessageToken handles.

A memory manager is responsible for:

  • allocating storage for new messages,
  • resolving tokens back to stored messages,
  • providing shared and exclusive borrows of stored messages,
  • releasing storage when a token is no longer needed,
  • reporting capacity and memory-class information.

The trait is intentionally typed over a single payload type P. A concrete manager instance stores only Message<P> values.

The API remains small and direct:

Shared header access is provided separately through the HeaderStore supertrait.

§Guard-based borrows

The borrow-returning methods use associated guard types instead of plain references so implementations can support both:

  • zero-overhead plain references in single-threaded managers, and
  • slot-level synchronization in concurrent managers.

For example:

  • a static or heap-backed manager may use &Message<P> and &mut Message<P> directly;
  • a concurrent manager may use wrapper types around slot-level read/write lock guards that dereference to Message<P>.

This keeps the public API stable while allowing implementations to choose the correct synchronization strategy internally.

Traits§

MemoryManager
Typed storage interface for token-addressed messages.
ScopedManager
Scoped handle factory for memory managers used in concurrent execution.