Skip to content
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

Why CookieJar uses 'static lifetime on cookies? #143

Open
AngelicosPhosphoros opened this issue Feb 17, 2020 · 3 comments
Open

Why CookieJar uses 'static lifetime on cookies? #143

AngelicosPhosphoros opened this issue Feb 17, 2020 · 3 comments

Comments

@AngelicosPhosphoros
Copy link

I just don't understand why.

As I assume, cookies lives only during request handling (from parsing http headers until finishing sending http body). Why CookieJar uses 'static attribute on definitely non-static data?

The other questions: Does it leak memory by making non-static data static? How it is making cookie data static?

The method that I am talking about is here.

@AngelicosPhosphoros
Copy link
Author

If I understood correctly, the all data getters of Cookie<'static> returns references with lifetime bound to reference to &Cookie itself but not to lifetime generic parameter of the struct definition.

@rsnakard-r7
Copy link
Contributor

rsnakard-r7 commented Feb 18, 2020

#137 - I don't think any particular reason. In this PR @SergioBenitez says he's fine with lifetime changes

@AngelicosPhosphoros
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants