feat(build): emit checked param tokens

Generate ParamName constants for handle data parameters so public code can refer to checked param metadata instead of stringly typed names.

req: codegen/003
This commit is contained in:
slhx agent
2026-05-26 01:28:51 +02:00
parent 280464017b
commit ba3f40a3f0
4 changed files with 57 additions and 2 deletions
+29
View File
@@ -186,6 +186,35 @@ impl core::fmt::Display for CssClass {
}
}
/// A generated, checked parameter token.
/// req: codegen/003
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub struct ParamName {
name: &'static str,
}
impl ParamName {
pub const fn new(name: &'static str) -> Self {
Self { name }
}
pub const fn as_str(self) -> &'static str {
self.name
}
}
impl AsRef<str> for ParamName {
fn as_ref(&self) -> &str {
self.name
}
}
impl core::fmt::Display for ParamName {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_str(self.name)
}
}
/// A generated, checked component token.
/// req: component/003
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]