nros_platform/board/exit.rs
1//! [`BoardExit`] — Phase 212.N.1.
2//!
3//! Per-board termination contract. Mirrors the legacy
4//! `nros-board-common::board_init::BoardExit`.
5//!
6//! Implementations:
7//! - QEMU boards → `cortex_m_semihosting::debug::exit(EXIT_*)`.
8//! - Real hardware → reset chip / halt in `wfi` / signal watchdog.
9//! - POSIX → `std::process::exit(code)`.
10//! - RTOS native sim (Zephyr / NuttX native_sim) → kernel-specific
11//! shutdown then `_exit`.
12//!
13//! Both methods diverge (`-> !`) because `BoardEntry::run`'s body is
14//! `-> Result<…>` only inside the `setup` callback; the outer
15//! lifecycle never returns to the caller of `run`.
16
17/// Per-board termination contract.
18pub trait BoardExit {
19 /// Terminate cleanly after the user closure returned `Ok`.
20 fn exit_success() -> !;
21
22 /// Terminate after the user closure returned `Err` or an init
23 /// step failed.
24 fn exit_failure() -> !;
25}