test(examples): render hemplate views into buffers
Use hemplate render_into in public examples and example tests instead of the string-returning render helper, preserving SafeHtml wrapping only at the explicit effect boundary. req: view/001 req: html_safety/002
This commit is contained in:
@@ -40,11 +40,11 @@ mod tests {
|
||||
|
||||
fn render_fast_metric(label: &'static str) -> SafeHtml {
|
||||
// req: html_safety/002 req: view/001
|
||||
SafeHtml::trusted(
|
||||
FastMetric { label }
|
||||
.render()
|
||||
.expect("techdemo fast metric renders"),
|
||||
)
|
||||
let mut html = String::new();
|
||||
FastMetric { label }
|
||||
.render_into(&mut html)
|
||||
.expect("techdemo fast metric renders");
|
||||
SafeHtml::trusted(html)
|
||||
}
|
||||
|
||||
// req: examples/001 req: form/001 req: form/004 req: form/006 req: derive_handler/003
|
||||
|
||||
@@ -549,7 +549,11 @@ fn render_control_center(page: ControlCenter) -> String {
|
||||
}
|
||||
|
||||
fn render_template(template: &impl Hemplate) -> String {
|
||||
template.render().expect("techdemo hemplate partial renders")
|
||||
let mut html = String::new();
|
||||
template
|
||||
.render_into(&mut html)
|
||||
.expect("techdemo hemplate partial renders");
|
||||
html
|
||||
}
|
||||
|
||||
fn render_html(template: &impl Hemplate) -> SafeHtml {
|
||||
|
||||
Reference in New Issue
Block a user