feat(build): emit checked component refs
Generate ComponentRef constants for component-scoped APIs, include global component refs only when global_exports(true) is enabled, and document/use the checked component token. req: component/003
This commit is contained in:
@@ -186,6 +186,35 @@ impl core::fmt::Display for CssClass {
|
||||
}
|
||||
}
|
||||
|
||||
/// A generated, checked component token.
|
||||
/// req: component/003
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
|
||||
pub struct ComponentRef {
|
||||
name: &'static str,
|
||||
}
|
||||
|
||||
impl ComponentRef {
|
||||
pub const fn new(name: &'static str) -> Self {
|
||||
Self { name }
|
||||
}
|
||||
|
||||
pub const fn as_str(self) -> &'static str {
|
||||
self.name
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRef<str> for ComponentRef {
|
||||
fn as_ref(&self) -> &str {
|
||||
self.name
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Display for ComponentRef {
|
||||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
f.write_str(self.name)
|
||||
}
|
||||
}
|
||||
|
||||
/// A generated, checked event token.
|
||||
/// req: codegen/006
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
|
||||
|
||||
Reference in New Issue
Block a user