actix / actix-web

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.
https://actix.rs
Apache License 2.0
21.6k stars 1.67k forks source link

FromRequest and UserSession #1029

Closed chachacha3 closed 5 years ago

chachacha3 commented 5 years ago

I want to handle session data using own extractor but the FromRequest's method from_request accepts not mutable reference as first argument. UserSession's method get_session() accepts only mutable reference.

is it ok and request object just need to be cloned? Is it good way?

fafhrd91 commented 5 years ago

You can clone HttpRequest. Could you eplain why do you want to use your own extractor? If you want to implement custom session backend, check cookie and redis session backends

chachacha3 commented 5 years ago

I realize it's a bad approach, but it's just for now. The thing is I don't want to create askama base template every time with much of user info in every handler manually, and don't want to create middleware for that purpose for now too, because seems like askama author already want to create separate askama crate for actix-web. About the subject, if there is only one option - clone - ok, I will close the issue. Thank you!