Skip to main content

pforge_runtime/handlers/
wrappers.rs

1// Handler trait implementations for CLI and HTTP handlers
2use crate::handlers::cli::{CliHandler, CliInput, CliOutput};
3#[cfg(feature = "http-handlers")]
4use crate::handlers::http::{HttpHandler, HttpInput, HttpOutput};
5use crate::{Error, Handler, Result};
6use async_trait::async_trait;
7
8// CLI Handler Wrapper
9#[async_trait]
10impl Handler for CliHandler {
11    type Input = CliInput;
12    type Output = CliOutput;
13    type Error = Error;
14
15    async fn handle(&self, input: Self::Input) -> Result<Self::Output> {
16        self.execute(input).await
17    }
18}
19
20// HTTP Handler Wrapper
21#[cfg(feature = "http-handlers")]
22#[async_trait]
23impl Handler for HttpHandler {
24    type Input = HttpInput;
25    type Output = HttpOutput;
26    type Error = Error;
27
28    async fn handle(&self, input: Self::Input) -> Result<Self::Output> {
29        self.execute(input).await
30    }
31}