-
-
Notifications
You must be signed in to change notification settings - Fork 228
Implement Responder trait for actix-web #104
Conversation
|
||
// Implement Actix-web's `Responder`. | ||
fn impl_actix_web_responder(&mut self) { | ||
//let lifetime = syn::Lifetime::new("'askama", Span::call_site()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bah, I forgot to remove these. They can be taken out,actix_web::Responder
doesn't need 'em.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff, I've been wanting to get this in!
I have a number of small things that I'd like to improve before I merge this. I can do it some time soon if you don't want to spend more time on it, but if you can that would be much appreciated.
askama/Cargo.toml
Outdated
|
||
[dependencies] | ||
askama_derive = { path = "../askama_derive", version = "0.7.0" } | ||
askama_shared = { version = "0.7.0", path = "../askama_shared" } | ||
iron = { version = ">= 0.5, < 0.7", optional = true } | ||
rocket = { version = "0.3", optional = true } | ||
actix-web = { version = ">= 0.6", optional = true } | ||
mime_guess = { version = "2.0.0-alpha", optional = true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we depend on a stable version here, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this 2.0.0-alpha
? That's...
- Unfortunately, what
actix-web
currently relies on - And currently a choice of theirs to remain at this release until the
mime
crate stabilizes: https://github.com/abonander/mime_guess
I know, I found it weird too.
@@ -9,15 +9,17 @@ default = [] | |||
nightly = ["rocket", "rocket_codegen", "askama/with-rocket"] | |||
|
|||
[dependencies] | |||
askama = { path = "../askama", version = "*", features = ["with-iron", "serde-json"] } | |||
askama = { path = "../askama", version = "*", features = ["iron", "serde-json"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is probably responsible for the test failures, the feature in askama
is still called with-iron
here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I'd like to have the Cargo manifest changes for the testing
crate in the earlier test
commit. I can take care of that if you prefer, though.
serde_json = "1.0" | ||
|
||
[build-dependencies] | ||
askama = { path = "../askama", version = "*", features = ["with-iron", "serde-json"] } | ||
askama = { path = "../askama", version = "*", features = ["iron", "serde-json"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also needs to be reverted, I think.
Hmm, it'd probably be a bit before I could circle back to these (and to be honest, all the testing stuff confused me slightly here, so I'd honestly defer to you on it). Let me know if you need anything more from me though? Glad it's (mostly) there~ |
…r the template. Surprisingly useful.
One other thing I added over in my fork that I found useful - a method on the |
Ah, amazing! Thanks again! |
Oh, quick question - when do you plan on throwing this up to crates.io? |
I just released 0.7.1. 👍 |
Heya!
Wound up needing this and figured I'd throw it over as a pull request. It's built for
actix-web
0.7 which went out less than 12 hours ago, but I originally built it against0.6.x
and it should work there too ('s why I include themime_guess
crate rather than rely onactix-web
'sfs::{}
methods).Test passes, but I couldn't figure out how you were opting to run against different web frameworks (Iron/Rocket/etc) so it needs to be enabled to run. Hoping this is the ~90% that lets you do the last 10% to make it correct per your package design, or something.
Cheers!