Skip to main content

Module runtime

Module runtime 

Source
Expand description

A simple, single-threaded async runtime for no_std cFS applications.

This module provides an ergonomic runtime that integrates with the cFS scheduler. The primary entry point is the Runtime struct.

§Usage

The entire application, from initialization to the main processing loops, can be defined within a single async block.

use leodos_libcfs::join;
use leodos_libcfs::runtime::Runtime;
use leodos_libcfs::cfe::{evs, sb::pipe::Pipe};

async fn task_one(pipe: &Pipe) { /* ... */ }
async fn task_two() { /* ... */ }

#[no_mangle]
pub extern "C" fn CFE_ES_Main() {
    Runtime::new().run(async {
        evs::event::register(&[]).expect("EVS registration failed");
        let pipe = Pipe::new("MY_PIPE", 16).expect("Pipe creation failed");

        join!(task_one(&pipe), task_two()).await;
    });
}

Modules§

dyn_scope
A dynamic task scope for managing pinned futures.
join
Structured concurrency primitives.
reactor
Reactor: a per-task registry of fds waiting for IO.
scope
Scope - owns tasks and is itself a Future
select_either
A simple implementation of select for futures.
sync
Synchronization primitives for Leodos LibCFS.
time
Asynchronous timer utilities.

Macros§

pin_mut
Pins a value on the stack.
select_biased
Polls multiple futures and streams simultaneously, executing the branch for the future that finishes first. Unlike select!, if multiple futures are ready, one will be selected in order of declaration. Futures directly passed to select_biased! must be Unpin and implement FusedFuture.

Structs§

Runtime
An async runtime designed to integrate with the cFS application lifecycle.

Traits§

FutureExt
An extension trait for Futures that provides a variety of convenient adapters.