CommandExecutor

Trait CommandExecutor 

Source
pub trait CommandExecutor:
    Environment
    + Send
    + Sync {
    // Required methods
    fn ExecuteCommand<'life0, 'async_trait>(
        &'life0 self,
        CommandIdentifier: String,
        Argument: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn RegisterCommand<'life0, 'async_trait>(
        &'life0 self,
        SideCarIdentifier: String,
        CommandIdentifier: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn UnregisterCommand<'life0, 'async_trait>(
        &'life0 self,
        SideCarIdentifier: String,
        CommandIdentifier: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn GetAllCommands<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CommonError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

An abstract service contract for an environment component that can execute and manage commands within the application.

This trait is implemented by the concrete MountainEnvironment and provides the core logic for the command palette and programmatic command execution. It is designed to handle both native commands implemented in Rust and proxied commands implemented in external sidecars.

Required Methods§

Source

fn ExecuteCommand<'life0, 'async_trait>( &'life0 self, CommandIdentifier: String, Argument: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Executes a command with the given identifier and arguments.

§Parameters
  • CommandIdentifier: The unique ID of the command to execute.
  • Argument: A serde_json::Value containing the arguments for the command.
§Returns

A Result containing the command’s return value as a serde_json::Value on success, or a CommonError on failure.

Source

fn RegisterCommand<'life0, 'async_trait>( &'life0 self, SideCarIdentifier: String, CommandIdentifier: String, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Registers a command that is implemented in an external sidecar process.

§Parameters
  • SideCarIdentifier: The unique ID of the sidecar where the command logic resides.
  • CommandIdentifier: The unique ID of the command being registered.
Source

fn UnregisterCommand<'life0, 'async_trait>( &'life0 self, SideCarIdentifier: String, CommandIdentifier: String, ) -> Pin<Box<dyn Future<Output = Result<(), CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Unregisters a previously registered command.

Source

fn GetAllCommands<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CommonError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieves a list of all currently registered command identifiers.

Implementors§