🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async
framework
gemini-protocol
protocol
gemini
rust
1use async_trait::async_trait;
2
3use crate::{context::ErrorContext, response::Response};
4
5#[allow(clippy::module_name_repetitions)]
6#[async_trait]
7pub trait ErrorResponse: Send + Sync {
8 async fn call(&mut self, context: ErrorContext) -> Response;
9}
10
11#[async_trait]
12impl<T, F> ErrorResponse for T
13where
14 T: FnMut(ErrorContext) -> F + Send + Sync,
15 F: std::future::Future<Output = Response> + Send + 'static,
16{
17 async fn call(&mut self, context: ErrorContext) -> Response {
18 (*self)(context).await
19 }
20}