-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Axum documentation states askama_axum
import is required, but it's not?
#999
Comments
@djc: Is it another issue with "the askama book is the not yet released version?". If so we should have a "nightly" and "stable" link for both, what do you think? |
Another thing I noticed is that the example test file linked in the book also does not follow the recommendation of using the |
IIRC someone tried this and it introduced a lot of complexity (there's probably a closed PR somewhere), which I didn't like. If there's an efficient way (in terms of added code/complexity) to do it, would be okay -- but also this kind of disparity is pretty rare and it's not like we get a zillion issues from it. |
Just as some feedback I spent around 1h trying to figure out why I wasn't getting askama_axum::Template with askama 0.12 as the book recommends. |
It seems like the underlying question didn't end up getting answered on this. Can some more context be provided to help users that are confused by the docs? In 0.12.1, if a config.toml imports both askama and askama_axum, then askama_axum enables askama/with-axum, which in turn enables askama-derive/with-axum. askama_axum::Template is a re-export of askama::Template, so at least with the current released code, using askama::Template just works. It sounds like this won't work in the future though - maybe? Would it make sense to make the Edit: there's a bit of a subtle bug in the current situation. When the with-axum feature is enabled on askama, aksum-derive always generates the axum code, which requires askama-axum to be present. If you have a secondary crate without the askama-axum dependency, that crate will not compile correctly when with-axum is enabled in the main crate. |
The problem here is that the published documentation is for the main branch, which changed this. |
There's still a bug though right? |
It's an issue. I don't think it is a bug that can be addressed in this project, though? That's just feature unification happening in your Cargo workspace, not much Askama can do about it. |
Hi, consider this as much a question as an issue report. I am quite new to the Rust ecosystem, so forgive me if this comes across as a tad ignorant. The documentation for the Axum integration states:
However, when I have both
askama
andaskama_axum
installed, I can also use the 'regular'askama::Template
without getting any compilation issues. For example:Is this intended to work as such, and is it ok to keep using it like this? Why would one need to use
asaka_axum
and what extra does it do on top of the regular template?I am also interested in how Cargo manages dependencies. If I install
askama_axum
I can see thataskama
is listed as a dependency, so I would expect that if I listaskama_axum
as the only dependency inCargo.toml
, it would also bringaxum
along.However, if I modify the code above to use
askama_axum::Template
as the documentation states, and only installaskama_axum
, then I get the following compilation error:This is strange because
Template
is imported fromaskama_axum
and notaskama
. But it leads me to believe that I need to have bothaskama_axum
andaskama
listed inCargo.toml
, even though my code does not directly depend onaskama
. Is this intentional behavior? Should I be listing both? If so, why isaskama
not pulled in withaskama_axum
?Again, total novice here. Feel free to close this issue if it's too much of a hassle to answer. Thanks in advance.
The text was updated successfully, but these errors were encountered: