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:
+16
-4
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user