🏗️ Elegant & Highly Performant Async Gemini Server Framework for the Modern Age
async framework gemini-protocol protocol gemini rust
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(router): block macro

Fuwn aacd65ef 0f16e32d

+11 -5
+11 -5
src/router.rs
··· 45 45 response::Response, 46 46 }; 47 47 48 + macro_rules! block { 49 + ($body:expr) => { 50 + tokio::task::block_in_place(|| { 51 + tokio::runtime::Handle::current().block_on(async { $body }); 52 + }); 53 + }; 54 + } 55 + 48 56 macro_rules! or_error { 49 57 ($stream:ident, $operation:expr, $error_format:literal) => { 50 58 match $operation { ··· 740 748 &mut self, 741 749 mut module: impl AsyncModule + 'static + Send, 742 750 ) -> &mut Self { 743 - tokio::task::block_in_place(|| { 744 - tokio::runtime::Handle::current().block_on(async { 745 - module.on_attach(self).await; 751 + block!({ 752 + module.on_attach(self).await; 746 753 747 - (*self.async_modules.lock().await).push(Box::new(module)); 748 - }); 754 + (*self.async_modules.lock().await).push(Box::new(module)); 749 755 }); 750 756 751 757 self