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#[derive(Debug, Clone, Copy)]
5pub struct WellKnownMetadata {
6    pub path: &'static str,
7    pub name: &'static str,
8    pub description: &'static str,
9}
10
11inventory::collect!(WellKnownMetadata);
12
13impl WellKnownMetadata {
14    pub const fn new(path: &'static str, name: &'static str, description: &'static str) -> Self {
15        Self {
16            path,
17            name,
18            description,
19        }
20    }
21}
22
23pub fn get_wellknown_metadata(path: &str) -> Option<WellKnownMetadata> {
24    inventory::iter::<WellKnownMetadata>
25        .into_iter()
26        .find(|meta| meta.path == path)
27        .copied()
28}