plex-boot 0.1.0

experimental boot manager with live-loading ISO support and more cool things
Documentation
use crate::AppError;
use crate::core::bootables::DisplayOptions;
use crate::core::display::GopDisplay;
use crate::path::DiskManager;
use uefi::proto::console::text::Input;

/// Outcome for a blocking app run.
#[must_use]
pub enum AppResult {
    /// App finished and returned control to the caller.
    Done,
    /// App initiated a boot flow and should not return to the caller.
    Booted,
    /// Yield control back to the runner, indicates an App has not finished execution.
    /// This may be used to trigger a redraw from the runner.
    Yield,
    /// App encountered an unrecoverable error during execution.
    Error(AppError),
}

/// Borrowed UI and system resources for a running app.
pub struct AppCtx<'a> {
    /// Display buffer for drawing. Caller retains ownership.
    pub display: &'a mut GopDisplay<'a>,
    /// Input source for key events. Caller retains ownership.
    pub input: &'a mut Input,
    /// Disk access helpers scoped to the caller's lifetime.
    pub disk_manager: &'a DiskManager,
    /// Image handle for UEFI service calls.
    pub handle: uefi::Handle,
}

/// Blocking app entry point.
pub trait App {
    /// Executes the application logic, taking in system context resources.
    fn run(&mut self, ctx: &mut AppCtx) -> AppResult;
}

/// A trait that defines an App that can be drawn as an entry
/// in the boot menu.
pub trait DisplayEntry {
    /// Returns the options used to display this entry on the screen.
    fn display_options(&self) -> DisplayOptions;
}