studiole-command 0.4.1

A simple command execution framework with event subscription and progress tracking.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::prelude::*;

/// Handle execution of a request.
#[async_trait]
pub trait Execute<In, Out, E> {
    /// Execute a request and return the result.
    async fn execute(&self, request: &In) -> Result<Out, E>;
}

/// A request that can be executed by a handler.
pub trait Executable: Clone + Display + Sized {
    /// Successful result type.
    type Response: Debug + Send + Sync;
    /// Error type returned on failure.
    type ExecutionError: Debug + Send + Sync;
}