Expand description
Foundation primitives for the proxima workspace — the layer everything else
is built out of, and the one crate that cannot itself be expressed as a pipe
(proxima_primitives::Pipe is defined one level up, on top of this).
Every module carries the finest tier it can reach, so a bare-metal consumer takes a subset rather than a fork:
- unconditional, down to no_std + no-alloc:
arch,datagram_batch,factory::Named,markers,per_core,ring,time. The buffered ones (datagram_batch,per_core,ring) carry an inline fixed-cap form sized bybuild.rsalongside the heap form behindalloc. CI builds both--features allocand bare--no-default-featuresforthumbv7m-none-eabi(scripts/thumbv7m-cliff-gate.sh). alloc:arena,batchstd:buffer,signal, and thefactoryregistry (registry/config) andlive, which ride their own default-off features- orthogonal gates:
io(io-async) is no-alloc for the traits andallocforPrepend;park(park) is no_std but needs an OS futex;histogramneeds 64-bit atomics, so it is absent on cortex-m.
ProximaError is the shared error type. It carries two surfaces: the
String-payload variants (Decode(String), Config(String), …) that most
of the workspace still constructs, and the typed *Kind variants
(DecodeKind(DecodeError), ConfigKind(ConfigError), …) that let a caller
match on the failure without parsing a message. Typed is the convention;
this crate constructs only typed kinds. The String variants remain until
their owning crates migrate, and render identically either way.
Typed sources are erased through
Box<dyn core::error::Error + Send + Sync + 'static> so the sub-enum surface
is uniform regardless of whether the underlying source is std::io::Error,
serde_json::Error, FromUtf8Error, … core::error::Error is stable since
Rust 1.81 and the workspace is edition 2024 (1.85+), so it is always
available.
Re-exports§
pub use factory::Named;pub use serving_state::ServingFsmError;pub use serving_state::ServingState;
Modules§
- accept_
rule - The accept decision for speculative rows as loadable data:
AcceptRule::accepted_rowsis the pure decision, and its count is theacceptedargument ofcrate::serving_state::ServingState::accept_rows. - arch
- Per-chipset CPU hint intrinsics. This is the ONE place in the workspace that expresses architecture hints, so a primitive that wants one depends on this.
- arena
- Reused byte arena — append bytes, reference them by
(offset, len), read them back without copying. One backing allocation grown power-of-two; the store-once / reference-many shape (mirrors a consumer crate’sByteBuffer/HeapBuffer, but single-writer so no atomics). The consumer owns the reclamation policy:resetdrops everything at once, which is the right primitive for a bounded in-flight window that fully drains (e.g. a per-connection retransmit buffer between quiescent points). A ring / free-list layer can sit on top when out-of-order partial reclaim is needed. - batch
- Batched terminal writes: accumulate many encoded items into one buffer, then flush the whole accumulation to a sink in a SINGLE write. The discipline that turns N per-item writes into one — the expensive terminal op (a syscall, a DMA submit) is paid once per batch instead of per item, so a producer is never stalled per-item on a slow terminal.
- buffer
BufferPool/PooledBuf— per-worker byte-buffer reservoir. Folded in from the formerproxima-libsatellite crate: BufferPool leans onthread_local::ThreadLocalfor its per-worker routing, which has no no_std/alloc analog (it resolves OS thread identity), so the whole pool is std-only; alloc-only builds carry no public API here.- datagram_
batch - Canonical tiered datagram-I/O buffers.
- factory
- A generic, lock-free registry of named factories — the composition-from-config primitive shared by every name→thing registry in the workspace.
- histogram
- Lock-free latency/size histogram with a branchless base-2 bucket pick.
- kv_
decision - markers
- Compile-time marker traits for dispatch units.
- per_
core - Per-core sharded storage:
countslots, each emitting thread/core routed to one to cut contention on a shared structure (e.g. one MPMCringper core). - ring
- serving_
state - The serving control plane as one sans-IO state machine over the algebra: every transition performs exactly one program evaluation, or placement copies only, and the per-layer cache lives inside the variant a transition returns rather than in a cache object patched from outside.
- signal
- Sticky one-shot level signal — the cancellation / shutdown scope primitive.
- sized
- Build-time sizing constants emitted by
build.rsfromproxima-core.toml(principle 12). Only theno_std + no-alloctier is bounded by these; the alloc tier grows dynamically. - time
proxima_core::time(re-exported asproxima::time) — runtime-agnostic timer primitives shaped liketokio::time. The active backend (host thread, embassy, prime’s per-core wheel, deterministic mock, or a user-supplied hardware driver) is selected by the activeproxima_build::Profilevia thetimeraxis;build.rsbakes a&'static dyn Driversymbol into the build, soSleep::poll’s only runtime cost is one virtual dispatch.
Enums§
- Body
Error - Body-stream / worker-side failure.
- Config
Error - Configuration / spec error.
- Decode
Error - Decode failure during wire / format parsing.
- Encode
Error - Encode failure during wire / format serialization.
- NotFound
Error - Resource-not-found error.
- Proxima
Error - Record
Error - Recording / replay sink-side error.
- Registry
Error - Registry-level error (factories, listen protocols, codecs).
- Upstream
Error - Upstream / I/O-side failure.
Type Aliases§
- Error
Source - Erased source for typed sub-enum variants. Concrete error types
(
std::io::Error,serde_json::Error,FromUtf8Error,ParseIntError, etc.) all implcore::error::Errorand box cleanly through this alias. - Proxima
Result