- First, we need to implement a fake futures::task::Waker for when we create a new context (this is what our FakeWaker structure is for on lines 11 through 14)
- Since BiLocks require two owners, we will divide the ownership into two different structures, called Reader<T> (on lines 16 through 18) and Writer<T> (on lines 20 through 22)
- Our split() -> (Reader<u32>, Writer<u32>) function is just to structure/organize our code a bit better, and when calling BiLock::new(t: T) the return type is a tuple of two futures_util::lock::BiLock elements
Now that the preliminary code has been explained, let's dive into our main() function:
- On lines 30 through 34 we set up a new LocalPool, LocalExecutor, Waker (FakeWaker), and a LocalMap (map storage of local data within tasks) for creating a new Context, since we will be polling our locks manually for demonstration purposes.
- Lines 38 and 40 use the futures_util::lock::BiLock::poll_lock function, which returns...