Expand description
AsyncRefCell<T> โ an async-aware RefCell.
borrow() / borrow_mut() return futures that wait until the cell is
available instead of panicking. Built on top of AsyncCondition: when
the last outstanding guard is dropped, all waiting borrowers are woken
and race to re-probe the underlying RefCell. Losers re-queue.
This is a single-threaded primitive โ it holds a RefCell internally
and is !Sync. For cross-thread sharing, use a proper mutex crate.
Structsยง
- Async
RefCell - Single-threaded async-aware interior-mutability cell.
- Ref
- Shared immutable guard returned by
AsyncRefCell::borrow. - RefMut
- Exclusive mutable guard returned by
AsyncRefCell::borrow_mut. - Scoped
Ticket - RAII condition ticket vended by
AsyncRefCell::scoped_ticket.