-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Adding docs on using tokio task_local to share state #2769
Adding docs on using tokio task_local to share state #2769
Conversation
8ae5f21
to
b2fea34
Compare
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.
Thanks for the PR! I think it makes sense to showcase this in the docs, but in addition to the small improvement suggestions below, there are two more general things:
- I think this documentation belongs in the main documentation, in the "Sharing state with handlers" section
- To me, the real important aspect about this is that unlike other state sharing mechanisms, this one actually also works to share state with
IntoResponse
impls; I think the docs should call this out
Hey @Gaelik-git, are you still interested in getting back to this? |
b2fea34
to
fd15ff5
Compare
Yep sorry for the late response, I moved and modified the example for it to include the IntoReponse implementation |
fd15ff5
to
442f658
Compare
… middleware and IntoResponse implementation
442f658
to
dee22b9
Compare
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.
Thanks again!
glad I could contribute |
I stumbled upon this discussion for using tokio task_local to share state between handlers and middleware.
Is it okay to add some docs, would you prefer to have some test or example to show the behaviour ?