diff options
Diffstat (limited to 'askama_derive/src/generator.rs')
-rw-r--r-- | askama_derive/src/generator.rs | 16 |
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> { |