Skip to content

Commit

Permalink
Merge pull request #125 from kornelski/dynWrite
Browse files Browse the repository at this point in the history
Take writer by value
  • Loading branch information
kaj committed Jul 15, 2023
2 parents 62993ca + 2ef89aa commit 290ad9e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/template.rs
Expand Up @@ -41,7 +41,7 @@ impl Template {
writeln!(
out,
"\n\
pub fn {name}<{ta}{ta_sep}W>(_ructe_out_: &mut W{args}) -> io::Result<()>\n\
pub fn {name}<{ta}{ta_sep}W>(#[allow(unused_mut)] mut _ructe_out_: W{args}) -> io::Result<()>\n\
where W: Write {{\n\
{body}\
Ok(())\n\
Expand Down
4 changes: 2 additions & 2 deletions src/templateexpression.rs
Expand Up @@ -82,7 +82,7 @@ impl TemplateExpression {
format!("_ructe_out_.write_all({text:?}.as_bytes())?;\n")
}
TemplateExpression::Expression { ref expr } => {
format!("{expr}.to_html(_ructe_out_)?;\n")
format!("{expr}.to_html(_ructe_out_.by_ref())?;\n")
}
TemplateExpression::ForLoop {
ref name,
Expand Down Expand Up @@ -122,7 +122,7 @@ impl TemplateExpression {
),
TemplateExpression::CallTemplate { ref name, ref args } => {
format!(
"{name}(_ructe_out_{})?;\n",
"{name}(_ructe_out_.by_ref(){})?;\n",
args.iter().format_with("", |arg, f| f(&format_args!(
", {arg}"
))),
Expand Down

0 comments on commit 290ad9e

Please sign in to comment.