Expand description
Platform abstraction layer — multi-backend (WP0→WP3).
Every runtime primitive used by the library core is routed through this module. Two backends:
| feature | backend | target |
|---|---|---|
platform-tokio (default, implies std) | tokio + parking_lot | server/desktop |
platform-embassy | embassy-time / embassy-sync / critical-section | embedded (ESP32-S3) |
Deliberate differences:
spawnon the embassy backend goes through an injected function pointer (set_spawn_fn), implemented by the application (rtcembed) on top of its executor’s task pool — rsipstack does not depend on any specific executor and therefore stays neutral about the target chip/arch. Panics when unset (same as tokio without a runtime).mpsc::channel(n)capacity is ignored on the embassy backend (effectively unbounded); core usage is all low-frequency paths.tokio::nettransports (udp/tcp/tls/websocket/stream) exist only inplatform-tokiobuilds (gated since WP1).
The select combinators (select2/select3) are backend-agnostic;
see select.
Re-exports§
pub use select::select2;pub use select::select3;pub use select::Either;pub use select::Select2;pub use select::Select3;pub use select::Which3;
Modules§
- atomic64
- 64-bit atomic counters that degrade gracefully on targets without 64-bit
atomics (ESP32-S3 etc.): backed by
AtomicU32, values wrap at 2^32 — fine for transaction IDs / counters within a session lifetime. - mpsc
- A multi-producer, single-consumer queue for sending values between asynchronous tasks.
- net
- Backend-agnostic UDP socket seam for the transport layer (WP3).
- select
- Backend-agnostic racing combinators (replace
tokio::select!at the drive-loop sites). Poll-based and unbiased: both futures are polled on every wake; whichever completes first wins. - sync
- Internal data-structure primitives, implemented per backend:
- tls
- Backend-agnostic TLS client seam (SIPS).
Structs§
- Cancellation
Token - A token which can be used to signal a cancellation request to one or more tasks.
- Elapsed
- Errors returned by
Timeout. - Instant
- A measurement of a monotonically nondecreasing clock.
Opaque and useful only with
Duration. - Join
Handle - An owned permission to join on a task (await its termination).
- Notify
- Notifies a single task to wake up.
Functions§
- sleep
- Sleeps for the given duration.
- spawn
- Spawns a task on the platform runtime.
- spawn_
with_ result - Spawns a task that resolves through the returned
JoinHandle. - timeout
- Applies a timeout to a future.