Skip to main content

Initialiser

Trait Initialiser 

Source
pub trait Initialiser:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn is_configured<'life0, 'life1, 'async_trait>(
        &'life0 self,
        app: &'life1 App,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn configure<'life0, 'life1, 'async_trait>(
        &'life0 self,
        app: &'life1 App,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

A pluggable bootstrap step run by the init subcommand.

Initialisers typically prompt for configuration values, write a user config file, set up OS keychain entries, generate SSH keys, etc. The init command iterates every registered initialiser in registration order, skipping any that report is_configured == true unless the user passes --force.

Required Methods§

Source

fn name(&self) -> &'static str

Short identifier shown in init output.

Source

fn is_configured<'life0, 'life1, 'async_trait>( &'life0 self, app: &'life1 App, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Returns true if this initialiser’s prerequisites are already met — e.g. the relevant config key is present.

Source

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

Perform the bootstrap. Typically interactive.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§