Skip to content

How do I use Rc inside middleware? #3019

Answered by jplatte
squeaktoy asked this question in Q&A
Discussion options

You must be logged in to vote

Using a non-Send type inside of an async fn does not automatically make its future type non-Send. That only happens when you declare a binding of such a type before the last .await point (roughly speaking).

If you don't need to hold the RNode across a .await point, the best solution is probably to move all the xrust logic into a regular fn that is called by your async fn. I took a brief look at your code and think this should work there.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@squeaktoy
Comment options

Answer selected by squeaktoy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants