fix(core): type slot render payloads

Tighten typed Slot::render and KeyedSlot append/prepend/replace helpers so callers pass the generated slot payload type, keeping explicit html/text escape hatches for deliberate conversions.

req: codegen/002

req: typed_id/001
This commit is contained in:
slhx agent
2026-05-26 00:12:45 +02:00
parent 5364135c5e
commit 814be5922a
3 changed files with 22 additions and 9 deletions
+16 -4
View File
@@ -713,7 +713,10 @@ impl<T> Slot<T> {
self.id
}
pub fn render(self, value: impl ToString) -> Effect {
pub fn render(self, value: T) -> Effect
where
T: ToString,
{
self.text(value)
}
@@ -761,7 +764,10 @@ where
self.id
}
pub fn append(self, key: K, value: impl ToString) -> Effect {
pub fn append(self, key: K, value: T) -> Effect
where
T: ToString,
{
Effect::Insert {
target: ResourceRef::unscoped(self.id),
key: key.to_string(),
@@ -769,7 +775,10 @@ where
}
}
pub fn prepend(self, key: K, value: impl ToString) -> Effect {
pub fn prepend(self, key: K, value: T) -> Effect
where
T: ToString,
{
Effect::Prepend {
target: ResourceRef::unscoped(self.id),
key: key.to_string(),
@@ -777,7 +786,10 @@ where
}
}
pub fn replace(self, key: K, value: impl ToString) -> Effect {
pub fn replace(self, key: K, value: T) -> Effect
where
T: ToString,
{
let key = key.to_string();
Effect::Put {
target: ResourceRef {