New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't pass Content argument to next template #134
Comments
Yes, I have also seen some problem related to this in the last release, after merging #125 . @kornelski , could you take a look at this, could the type for |
The problem here is that So when calling a template, there needs to be something anti-by-ref that decreases levels of indirection. This hack works:
Here's a minimal example: use std::io::{self, Write};
pub fn contentcall_html<W>(#[allow(unused_mut)] mut _ructe_out_: W, content: impl FnOnce(&mut W) -> io::Result<()>) -> io::Result<()>
where W: Write {
contentcallnext_html(_ructe_out_.by_ref(), |w| content(*w))?;
Ok(())
}
pub fn contentcallnext_html<W>(#[allow(unused_mut)] mut _ructe_out_: W, content: impl FnOnce(&mut W) -> io::Result<()>) -> io::Result<()>
where W: Write {
content(_ructe_out_.by_ref())?;
Ok(())
} @kaj Are you able to detect when argument to |
I wonder if ructe could define its own trait that calls things, so that dealing with |
Hi, consider the following two templates
first_template.rs.html:
next_template.rs.html:
Compilation fails with the following:
Is it possible to pass Content from a template to the next ?
Thanks !
The text was updated successfully, but these errors were encountered: