starlane 0.3.21

Starlane -- An Orchestration and Infrastructure Framework for WebAssembly Components (https://starlane.io) This packaged manages `HyperSpace` which provides infrastructure for `Space` Apis (WebAssembly & external programs meant to provide custom behaviors in Starlane), This package references the `starlane-space` package and reuses of it to run the infrastructure and it also contains mechanisms (Drivers) for extending the Starlane Type system
Documentation
pub fn state_relay<S>(
    initial: S,
) -> (
    tokio::sync::mpsc::Sender<S>,
    tokio::sync::watch::Receiver<S>,
)
where
    S: Clone + Send + Sync + 'static,
{
    let (mpsc_tx, mut mpsc_rx) = tokio::sync::mpsc::channel(8);
    let (watch_tx, watch_rx) = tokio::sync::watch::channel(initial);

    tokio::task::spawn(async move {
        while let Some(state) = mpsc_rx.recv().await {
            match watch_tx.send(state) {
                Err(err) => {}
                _ => {}
            }
        }
    });

    (mpsc_tx, watch_rx)
}