diff options
author | cel 🌸 <cel@blos.sm> | 2024-01-24 20:23:18 +0000 |
---|---|---|
committer | cel 🌸 <cel@blos.sm> | 2024-01-24 20:23:18 +0000 |
commit | d3b048544eebf7b8402fb585b4e2531de9b28a33 (patch) | |
tree | 2e697063854d22aff603ba3691c6453ddf5cd87b /askama_derive/src | |
parent | ef53238ae2ee77becc44bcb0b77c1c4daceca5af (diff) | |
download | askama-main.tar.gz askama-main.tar.bz2 askama-main.zip |
Diffstat (limited to 'askama_derive/src')
-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> { |