🏗️ 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: simplify imports

Fuwn 230dd187 e20e9f7c

+11 -20
-2
README.md
··· 40 40 ```rust 41 41 // src/main.rs 42 42 43 - use windmark::Response; 44 - 45 43 #[windmark::main] 46 44 async fn main() -> Result<(), Box<dyn std::error::Error>> { 47 45 windmark::Router::new()
+1 -3
examples/async_stateful_module.rs
··· 17 17 18 18 //! `cargo run --example async_stateful_module --features response-macros` 19 19 20 - use std::sync::{Arc, Mutex}; 21 - 22 20 use windmark::{context::HookContext, Router}; 23 21 24 22 #[derive(Default)] 25 23 struct Clicker { 26 - clicks: Arc<Mutex<usize>>, 24 + clicks: std::sync::Arc<std::sync::Mutex<usize>>, 27 25 } 28 26 29 27 #[async_trait::async_trait]
+1 -3
examples/struct_router.rs
··· 17 17 18 18 //! `cargo run --example struct_router` 19 19 20 - use rossweisse::route; 21 - 22 20 #[rossweisse::router] 23 21 struct Router { 24 22 _phantom: (), ··· 26 24 27 25 #[rossweisse::router] 28 26 impl Router { 29 - #[route(index)] 27 + #[rossweisse::route(index)] 30 28 pub fn index( 31 29 _context: windmark::context::RouteContext, 32 30 ) -> windmark::Response {
+1 -3
rossweisse/README.md
··· 9 9 For now, a simple Rosswiesse router can be implemented like this: 10 10 11 11 ```rust 12 - use rossweisse::route; 13 - 14 12 #[rossweisse::router] 15 13 struct Router { 16 14 _phantom: (), ··· 18 16 19 17 #[rossweisse::router] 20 18 impl Router { 21 - #[route(index)] 19 + #[rossweisse::route(index)] 22 20 pub fn index( 23 21 _context: windmark::context::RouteContext, 24 22 ) -> windmark::Response {
+1 -2
rossweisse/src/implementations/router/fields.rs
··· 17 17 18 18 use proc_macro::TokenStream; 19 19 use quote::quote; 20 - use syn::parse_macro_input; 21 20 22 21 pub fn fields(arguments: TokenStream, item: syn::ItemStruct) -> TokenStream { 23 - let field_initializers = parse_macro_input!( 22 + let field_initializers = syn::parse_macro_input!( 24 23 arguments as super::parser::FieldInitializers<syn::Expr> 25 24 ); 26 25 let router_identifier = item.ident;
+1 -1
rossweisse/src/implementations/router/parser/field_initializer.rs
··· 24 24 pub expr: T, 25 25 } 26 26 27 - impl<T: Parse> parse::Parse for FieldInitializer<T> { 27 + impl<T: Parse> Parse for FieldInitializer<T> { 28 28 fn parse(input: parse::ParseStream<'_>) -> syn::Result<Self> { 29 29 let ident = input.parse()?; 30 30 let eq_token = input.parse()?;
+1 -1
rossweisse/src/implementations/router/parser/field_initializers.rs
··· 21 21 22 22 pub struct FieldInitializers<T: Parse>(pub Vec<FieldInitializer<T>>); 23 23 24 - impl<T: Parse> parse::Parse for FieldInitializers<T> { 24 + impl<T: Parse> Parse for FieldInitializers<T> { 25 25 fn parse(input: parse::ParseStream<'_>) -> syn::Result<Self> { 26 26 Ok(Self(syn::punctuated::Punctuated::<FieldInitializer<T>, syn::Token![,]>::parse_terminated(input)?.into_iter().collect())) 27 27 }
+2 -2
src/module/asynchronous.rs
··· 15 15 // Copyright (C) 2022-2023 Fuwn <contact@fuwn.me> 16 16 // SPDX-License-Identifier: GPL-3.0-only 17 17 18 - use crate::{context::HookContext, Router}; 18 + use crate::context::HookContext; 19 19 20 20 #[async_trait::async_trait] 21 21 pub trait AsyncModule: Send + Sync { 22 22 /// Called right after the module is attached. 23 - async fn on_attach(&mut self, _: &mut Router) {} 23 + async fn on_attach(&mut self, _: &mut crate::Router) {} 24 24 25 25 /// Called before a route is mounted. 26 26 async fn on_pre_route(&mut self, _: HookContext) {}
+2 -2
src/module/sync.rs
··· 15 15 // Copyright (C) 2022-2023 Fuwn <contact@fuwn.me> 16 16 // SPDX-License-Identifier: GPL-3.0-only 17 17 18 - use crate::{context::HookContext, Router}; 18 + use crate::context::HookContext; 19 19 20 20 pub trait Module { 21 21 /// Called right after the module is attached. 22 - fn on_attach(&mut self, _: &mut Router) {} 22 + fn on_attach(&mut self, _: &mut crate::Router) {} 23 23 24 24 /// Called before a route is mounted. 25 25 fn on_pre_route(&mut self, _: HookContext) {}
+1 -1
src/router.rs
··· 359 359 360 360 url = or_error!( 361 361 stream, 362 - url::Url::parse(&request.replace("\r\n", "")), 362 + Url::parse(&request.replace("\r\n", "")), 363 363 "59 The server (Windmark) received a bad request: {}" 364 364 ); 365 365