Skip to content

Update to async askama - #3606

Draft
GuillaumeGomez wants to merge 1 commit into
rust-lang:mainfrom
GuillaumeGomez:async-askama
Draft

GuillaumeGomez wants to merge 1 commit into
rust-lang:mainfrom
GuillaumeGomez:async-askama

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

No description provided.

@github-actions github-actions Bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Oct 15, 2026

@syphar syphar left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I like the async askama feature, I imagine it being used differently.

( also I'm happy to implement it).

I don't see much advantage in async, when we buffer the response anyways.

So the real value only comes for streaming responses.

initial idea would be somewhere in our render_response middleware, where we could return a streaming body instead of the full buffer.

View changes since this review


match item.write_into(&mut buf) {
Ok(_) => {
match item.async_render_with_values(NO_VALUES).await {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is no real value from this being async?

If we want streaming responses while rendering we would probably build a small adapter using tokio::io::duplex so we can expose AsyncRead for axum.

fn render_with_csp_nonce(
&mut self,
csp_nonce: String,
) -> ::futures_util::future::BoxFuture<'_, askama::Result<String>> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to what I asked on the library:
if the result is a String, what's the value in the async machinery?

@rustbot

rustbot commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (possibly #3691) made this pull request unmergeable. Please resolve the merge conflicts.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants