Skip to main content

Module primitives

Module primitives 

Source
Expand description

RuntimeFactory sibling trait + the *Like primitive shapes.

Design constraint: Runtime stays dyn-compatible because the runtime threads &dyn Runtime through per-core dispatch, and GAT associated-type factories on it would break that workspace-wide. Resolution: a SIBLING trait RuntimeFactory: Runtime carries the typed primitive factories. TokioPerCoreRuntime and PrimeRuntime impl BOTH; consumers that need typed Mutex / Notify / JoinSet / Sleep bound on R: RuntimeFactory (which implies Runtime).

Enums§

JoinError
Opaque join-failure reason. Wraps the runtime’s native error type (tokio::task::JoinError for the tokio impl).

Traits§

JoinSetLike
A handle that yields a task’s result on await and supports abort. Matches tokio::task::JoinSet’s shape.
LocalMutexLike
Non-Send mutex shape for runtimes that pin tasks to a single core. The guard is !Send so callers can’t accidentally move it across cores; in exchange the underlying primitive can skip the atomic/notification dance a Send Mutex needs.
LocalNotifyLike
Non-Send notify shape. Same single-core opt-in contract as LocalMutexLike.
LocalRuntimeFactory
Sibling extension of Runtime for runtimes that pin tasks to a single core (prime’s per-core executor, embedded runtimes with no multi-thread executor at all). Provides non-Send primitive factories that skip the atomic synchronization a Send-shaped primitive needs.
MutexLike
Async mutex shape. The guard type is borrowed so callers can hold the lock across an await without paying a clone. Implementations supply the actual lock primitive — tokio::sync::Mutex<T> for the tokio impl, a per-core single-writer lock for prime.
NotifyLike
Notification primitive. notify_one wakes one waiter; subsequent notified().await resumes when the next signal arrives.
RuntimeFactory
Sibling extension of Runtime: typed factory methods for the per-session sync / task / time primitives. Implemented by every concrete runtime that ships in the workspace (TokioPerCoreRuntime, PrimeRuntime). Consumers bound on R: RuntimeFactory when they need typed primitives; consumers that only need to spawn stay on R: Runtime and the trait stays dyn-compatible.