aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/generator.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-01-24 20:23:18 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-01-24 20:23:18 +0000
commitd3b048544eebf7b8402fb585b4e2531de9b28a33 (patch)
tree2e697063854d22aff603ba3691c6453ddf5cd87b /askama_derive/src/generator.rs
parentef53238ae2ee77becc44bcb0b77c1c4daceca5af (diff)
downloadaskama-d3b048544eebf7b8402fb585b4e2531de9b28a33.tar.gz
askama-d3b048544eebf7b8402fb585b4e2531de9b28a33.tar.bz2
askama-d3b048544eebf7b8402fb585b4e2531de9b28a33.zip
Add poem integrationHEADmain
Diffstat (limited to '')
-rw-r--r--askama_derive/src/generator.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 22f996f..1a2537e 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -74,6 +74,8 @@ impl<'a> Generator<'a> {
self.impl_hyper_into_response(&mut buf)?;
#[cfg(feature = "with-mendes")]
self.impl_mendes_responder(&mut buf)?;
+ #[cfg(feature = "with-poem")]
+ self.impl_poem_into_response(&mut buf)?;
#[cfg(feature = "with-rocket")]
self.impl_rocket_responder(&mut buf)?;
#[cfg(feature = "with-tide")]
@@ -284,6 +286,20 @@ impl<'a> Generator<'a> {
Ok(())
}
+ // Implement Poem's `IntoResponse`.
+ #[cfg(feature = "with-poem")]
+ fn impl_poem_into_response(&mut self, buf: &mut Buffer) -> Result<(), CompileError> {
+ self.write_header(buf, "::askama_poem::IntoResponse", None)?;
+ buf.writeln("#[inline]")?;
+ buf.writeln(
+ "fn into_response(self)\
+ -> ::askama_poem::Response {",
+ )?;
+ buf.writeln("::askama_poem::into_response(&self)")?;
+ buf.writeln("}")?;
+ buf.writeln("}")
+ }
+
// Implement Rocket's `Responder`.
#[cfg(feature = "with-rocket")]
fn impl_rocket_responder(&mut self, buf: &mut Buffer) -> Result<(), CompileError> {