telegram_webapp_sdk/pages.rs
1// SPDX-FileCopyrightText: 2025 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4use inventory::collect;
5
6/// Represents a single routable page.
7#[derive(Copy, Clone)]
8pub struct Page {
9 /// URL path this page is mounted at.
10 pub path: &'static str,
11 /// Callback rendering the page when its path is matched.
12 pub handler: fn()
13}
14
15collect!(Page);
16
17/// Returns iterator over registered pages.
18pub fn iter() -> inventory::iter<Page> {
19 inventory::iter::<Page>
20}