Skip to main content

Crate corsa_runtime

Crate corsa_runtime 

Source
Expand description

Lightweight runtime primitives used by the stdio transports.

The runtime intentionally stays small: a single-thread block_on, a thread-backed spawn, and a broadcast channel for fan-out notifications.

§Examples

use corsa_runtime::{block_on, broadcast, spawn};
use std::time::Duration;

let value = block_on(async { 40 + 2 });
assert_eq!(value, 42);

let handle = spawn(async { 1_u32 + 2 });
assert_eq!(handle.join().unwrap(), 3);

let (sender, receiver) = broadcast();
assert_eq!(sender.send("ready"), 1);
assert_eq!(receiver.recv_timeout(Duration::from_millis(50)).unwrap(), "ready");

Structs§

BroadcastReceiver
Receiving side of a broadcast channel.
BroadcastSender
Broadcast sender that clones each message for all active subscribers.
JoinHandle
Join handle returned by spawn.

Functions§

block_on
Runs a future to completion on the current thread.
broadcast
Creates a broadcast channel and returns the first receiver.
spawn
Spawns a future onto a dedicated worker thread.