Skip to main content

systemprompt_runtime/
wellknown.rs

1//! Static metadata for `/.well-known/` routes registered with
2//! [`register_wellknown_route!`](crate::register_wellknown_route).
3//!
4//! Copyright (c) systemprompt.io — Business Source License 1.1.
5//! See <https://systemprompt.io> for licensing details.
6
7#[derive(Debug, Clone, Copy)]
8pub struct WellKnownMetadata {
9    pub path: &'static str,
10    pub name: &'static str,
11    pub description: &'static str,
12}
13
14inventory::collect!(WellKnownMetadata);
15
16impl WellKnownMetadata {
17    pub const fn new(path: &'static str, name: &'static str, description: &'static str) -> Self {
18        Self {
19            path,
20            name,
21            description,
22        }
23    }
24}
25
26pub fn get_wellknown_metadata(path: &str) -> Option<WellKnownMetadata> {
27    inventory::iter::<WellKnownMetadata>
28        .into_iter()
29        .find(|meta| meta.path == path)
30        .copied()
31}