Skip to main content

SystemCapability

Trait SystemCapability 

Source
pub trait SystemCapability: Send + Sync {
    // Provided methods
    fn pre_init(&self, _sys: &SystemContext) -> Result<()> { ... }
    fn post_init<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _sys: &'life1 SystemContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

System capability: receives runtime internals before init.

This trait is internal to toolkit and only used by gears with the “system” capability. Normal user gears don’t implement this.

Provided Methods§

Source

fn pre_init(&self, _sys: &SystemContext) -> Result<()>

Optional pre-init hook for system gears.

This runs BEFORE init() has completed for ALL gears, and only for system gears.

Default implementation is a no-op so most gears don’t need to implement it.

§Errors

Returns an error if system wiring fails.

Source

fn post_init<'life0, 'life1, 'async_trait>( &'life0 self, _sys: &'life1 SystemContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Optional post-init hook for system gears.

This runs AFTER init() has completed for ALL gears, and only for system gears.

Default implementation is a no-op so most gears don’t need to implement it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§