microde_application/context.rs
1use std::sync::Arc;
2
3use crate::{MicrodeError, MicrodeStopRequest};
4
5/// Operations exposed by a application to its installed modules.
6pub trait MicrodeContext: Send + Sync {
7 /// Requests an orderly stop and returns without waiting for lifecycle completion.
8 fn request_stop(&self, request: MicrodeStopRequest);
9
10 /// Terminates execution immediately, bypassing the orderly shutdown lifecycle.
11 fn panic(&self, error: Option<MicrodeError>) -> !;
12}
13
14/// An independently owned module-facing context.
15pub type MicrodeContextHandle = Arc<dyn MicrodeContext>;