Skip to main content

Module async_shim

Module async_shim 

Source
Expand description

Sync-over-async shim for transports whose underlying cipher / I/O is async (e.g. commonware-stream::encrypted) but whose Transport trait surface is intentionally sync.

Lives in mkit-core (the trait crate) because it is generic infrastructure — multiple transports and sparse-checkout’s transport layer will reuse the same plug-in point. It does not depend on tokio, commonware-runtime, or any concrete executor; callers pick the runner.

§Why a trait

mkit-transport-enc and (once its transport layer lands) mkit-core::sparse need to drive async fn bodies from a sync method. Hard-coding tokio::runtime::Handle::block_on would bleed tokio across the workspace; hard-coding commonware_runtime::deterministic would mean production = tests. A pluggable Executor keeps the runtime-choice at the consumer crate.

Traits§

Executor
Drives an async future to completion synchronously. Pluggable so callers can choose between tokio, commonware-runtime’s deterministic runner (tests), or the planned production tokio runner without mkit-core having to compile-time depend on a specific runtime crate.