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