IsEnvironment

Trait IsEnvironment 

Source
pub trait IsEnvironment: Debug + Display {
    type Err;

    // Required methods
    fn exists<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        command: CommandLine,
    ) -> Pin<Box<dyn Future<Output = Result<Command, Self::Err>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Trait for usable environments.

Required Associated Types§

Required Methods§

Source

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

Returns true if the given Env is available at all.

We assume the environment Host to be available unconditionally. Other environments, such as toolbx, can only be available when at least the toolbx executable is present, or we are currently inside a toolbx.

Source

fn execute<'life0, 'async_trait>( &'life0 self, command: CommandLine, ) -> Pin<Box<dyn Future<Output = Result<Command, Self::Err>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Execute a command within this environment

IsProvider implementations should prefer calling output_of() instead of interacting with an Environment instance directly. Refer to output_of() for details.

Implementors§