studiole_command/traits.rs
1use crate::prelude::*;
2
3/// Handle execution of a request.
4#[async_trait]
5pub trait Execute<In, Out, E> {
6 /// Execute a request and return the result.
7 async fn execute(&self, request: &In) -> Result<Out, E>;
8}
9
10/// A request that can be executed by a handler.
11pub trait Executable: Clone + Display + Sized {
12 /// Successful result type.
13 type Response: Debug + Send + Sync;
14 /// Error type returned on failure.
15 type ExecutionError: Debug + Send + Sync;
16}