pub struct MicrodeApplication { /* private fields */ }Expand description
Composes modules and coordinates their lifecycle.
Implementations§
Source§impl MicrodeApplication
impl MicrodeApplication
pub fn state(&self) -> MicrodeApplicationState
pub fn install<Module, Factory>( &mut self, factory: Factory, ) -> Result<(), MicrodeError>
pub fn install_named<Module, Factory>( &mut self, id: impl Into<String>, factory: Factory, ) -> Result<ModuleHandle<Module>, MicrodeError>
pub fn bind( &mut self, consumer: &dyn ModuleHandleIdentity, slot: &dyn RelationshipSlot, target: &dyn ModuleHandleIdentity, ) -> Result<(), MicrodeError>
Sourcepub fn serve(
&mut self,
) -> BoxFuture<'static, Result<MicrodeExecutionResult, MicrodeError>>
pub fn serve( &mut self, ) -> BoxFuture<'static, Result<MicrodeExecutionResult, MicrodeError>>
Serves the application using module completion and stop requests to control its lifetime.
The lifecycle continues if the returned future is dropped. Any later call to Self::stop
receives the same shared completion result.
Sourcepub fn run<Main, MainFuture>(
&mut self,
main: Main,
) -> BoxFuture<'static, Result<MicrodeExecutionResult, MicrodeError>>where
Main: FnOnce(MicrodeContextHandle) -> MainFuture + Send + 'static,
MainFuture: Future<Output = Result<(), MicrodeError>> + Send + 'static,
pub fn run<Main, MainFuture>(
&mut self,
main: Main,
) -> BoxFuture<'static, Result<MicrodeExecutionResult, MicrodeError>>where
Main: FnOnce(MicrodeContextHandle) -> MainFuture + Send + 'static,
MainFuture: Future<Output = Result<(), MicrodeError>> + Send + 'static,
Runs an application-level task after all modules have started.
Completion or failure of the task begins orderly application shutdown.
Sourcepub fn stop(
&self,
request: MicrodeStopRequest,
) -> BoxFuture<'static, Result<MicrodeExecutionResult, MicrodeError>>
pub fn stop( &self, request: MicrodeStopRequest, ) -> BoxFuture<'static, Result<MicrodeExecutionResult, MicrodeError>>
Requests an orderly stop and waits for lifecycle completion.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MicrodeApplication
impl !Sync for MicrodeApplication
impl !UnwindSafe for MicrodeApplication
impl Freeze for MicrodeApplication
impl Send for MicrodeApplication
impl Unpin for MicrodeApplication
impl UnsafeUnpin for MicrodeApplication
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more