How to construct !Send objects on another thread?
I have the following code:
Async-friendly RefCell that prevents borrow across await points
Is there any way to create a RefCell-like data structure that prevents a borrow from being held across an await point? I have a single-threaded async runtime and the internal state of my object is safe to mutate within a single thread. However, RefCell is dangerous because if I accidentally hold the borrow across an await point it’s no longer safe for the caller to have overlapping calls into the mutating API which is actually safe (they’ll panic because of duplicate borrows).