๐ฆ Shared โ
The shared crate is the low-level cross-cutting utility layer used by modules, drivers, and executables.
Role โ
- Centralizes reusable primitives that do not belong to one domain subsystem.
- Reduces duplication of utility code and shared type definitions across the workspace.
Boundaries โ
- In scope: generic helpers and value types (
flags,size,time, HTTP/unit/UTF-8/slice helpers, layout-based any wrappers). - Out of scope: module orchestration, stateful managers, backend-specific logic.
Internal structure โ
- Utility modules include
any,bijective_map,flags,http,size,slice,task,time,unit,utf8. error.rsprovides shared error representation utilities.
Runtime interaction โ
- Typically used as pure library calls/value containers.
- Frequently appears at crate boundaries where generic data conversion is needed (for example control payload casting and UTF-8 chunk iteration).
Dependency model โ
- Dependency-light by design (
num, workspacelog). - Sits near the bottom of the dependency graph and is imported by many crates.
Failure semantics โ
- Errors are mostly local utility conversion/validation errors (for example slice/layout checks).
- Crates consuming shared utilities usually remap these errors into their own domains.
Extension points โ
- Add new generic helpers when used by multiple subsystems.
- Keep module additions cohesion-focused to avoid this crate becoming a catch-all for domain logic.
Contract vs implementation โ
- Contract: stable, dependency-light utility API surface safe for broad workspace reuse.
- Current implementation: collection of no-std-friendly helper modules with selective logging integration.
Limitations and trade-offs โ
- Broad reuse increases API stability pressure.
- Keeping scope strictly "shared only" avoids coupling but may require small wrappers in consumer crates.