🏗️ 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.

fix(module): bring back

Fuwn 1e0a320f 6909271f

+61
+31
src/module/asynchronous.rs
··· 1 + // This file is part of Windmark <https://github.com/gemrest/windmark>. 2 + // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 3 + // 4 + // This program is free software: you can redistribute it and/or modify 5 + // it under the terms of the GNU General Public License as published by 6 + // the Free Software Foundation, version 3. 7 + // 8 + // This program is distributed in the hope that it will be useful, but 9 + // WITHOUT ANY WARRANTY; without even the implied warranty of 10 + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 + // General Public License for more details. 12 + // 13 + // You should have received a copy of the GNU General Public License 14 + // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + // 16 + // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 17 + // SPDX-License-Identifier: GPL-3.0-only 18 + 19 + use crate::{context::HookContext, Router}; 20 + 21 + #[async_trait::async_trait] 22 + pub trait AsyncModule: Send + Sync { 23 + /// Called right after the module is attached. 24 + async fn on_attach(&mut self, _: &mut Router) {} 25 + 26 + /// Called before a route is mounted. 27 + async fn on_pre_route(&mut self, _: HookContext<'_>) {} 28 + 29 + /// Called after a route is mounted. 30 + async fn on_post_route(&mut self, _: HookContext<'_>) {} 31 + }
+30
src/module/sync.rs
··· 1 + // This file is part of Windmark <https://github.com/gemrest/windmark>. 2 + // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 3 + // 4 + // This program is free software: you can redistribute it and/or modify 5 + // it under the terms of the GNU General Public License as published by 6 + // the Free Software Foundation, version 3. 7 + // 8 + // This program is distributed in the hope that it will be useful, but 9 + // WITHOUT ANY WARRANTY; without even the implied warranty of 10 + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 + // General Public License for more details. 12 + // 13 + // You should have received a copy of the GNU General Public License 14 + // along with this program. If not, see <http://www.gnu.org/licenses/>. 15 + // 16 + // Copyright (C) 2022-2022 Fuwn <contact@fuwn.me> 17 + // SPDX-License-Identifier: GPL-3.0-only 18 + 19 + use crate::{context::HookContext, Router}; 20 + 21 + pub trait Module { 22 + /// Called right after the module is attached. 23 + fn on_attach(&mut self, _: &mut Router) {} 24 + 25 + /// Called before a route is mounted. 26 + fn on_pre_route(&mut self, _: HookContext<'_>) {} 27 + 28 + /// Called after a route is mounted. 29 + fn on_post_route(&mut self, _: HookContext<'_>) {} 30 + }