I'm Altair, a software engineer from Málaga
- Backend nerd
- Fascinated by functional programming
- Focused on building fast & reliable software
- Interested in Microservices, Serverless and Distributed systems
Layers, extractors and template engine wrappers for axum based Web MVC applications
Home Page: https://crates.io/crates/axum-template
License: MIT License
infinity recursion call on
impl IntoResponse for TeraError fn into_response(self) ;
Hello,
I'm not super experience in rust nor with axum, so maybe there's an easy solution I miss, but I was wondering how I could access the Tera
object while using axum-template. My goal would be to reload template using tera.full_reload()
in development and only load them once in production.
Just a friendly heads up in case you're able to create a release. It seems dependabot already updated the handlebars dependency to 6.
Thanks again for working on this!
I'm sure you're already aware but either way may be useful to have a tracking issue for this.
Changelog including breaking changes available here.
Thank you for this crate!
I've ran into this situation:
async fn handler(
engine: impl TemplateEngine,
) -> impl IntoResponse {
let key = "Template key";
let data = Person{ /* */ };
RenderHtml(key, engine, data);
}
This renders nothing on the output and also produces no warnings!
Since RenderHtml
is not marked #[must_use]
the compiler happily ignored it and used the default return value of () as my IntoResponse
implementation.
Having #[must_use]
here would at least tell me something is up, and fix the error. (Since ;
is also fairly small and easy to miss)
Hey,
I like what you did but would like to add suggestion (I actually wanted to create a similar crate in the first place).
It should be possible to extract the MatchedPath and Engine in the FromRequestParts Trait by introducing a Trait to extract the engine from the state (ideally the trait can be applied like FromRef via a macro).
This allows to render the tenplate via a simpler simpler function call and also it requires only 1 parameter instead of 2 for each handler.
I haven't tested if it works but it shoud simplify the api drastically for users.
My use case is to listen on changes in the template directory and reload the templates (with Tera::full_reload()
).
I'm not sure how to provide the required &mut Tera
though.
Would it be possible to enable RenderHtml to accept the Tera Context instead of a struct? Some handlers might need to return RenderHtml with different templates (and thus different Models) and as far an I can see that won't work.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.