-
Anyone know how to get Actually I'm new to Rust itself (coming from C# and Python) and haven't been able to figure this out for any of the other Rust templating engines either (Tera, Askama). Actix Web does have a url_for on HttpRequest, but not sure what I need to do to integrate it with minijinja, or if someone has done it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
|
Beta Was this translation helpful? Give feedback.
-
I'm using rocket but cannot find something equivalent, any hints? |
Beta Was this translation helpful? Give feedback.
actix-web
makes this incredibly easy because the request object is cheaply clonable and can be stashed into a thread local. This means you can put it there before rendering, and then fetch that object back in aurl_for
function you can add to the template. I added an example that shows this: https://github.com/mitsuhiko/minijinja/blob/main/examples/actix-web-demo/src/main.rs