Step 3-Implementing a proper Reactor 201 ch08/b-reactor-executor/src/runtime/reactor. rs pub fn reactor()-> &'static Reactor { REACTOR. get(). expect("Called outside an runtime context") } The next thing we do is define our Reactor struct: ch08/b-reactor-executor/src/runtime/reactor. rs pub struct Reactor { wakers: Wakers, registry: Registry, next_id: Atomic Usize, } This will be all the state our Reactor struct needs to hold: wakers -A Hash Map of Waker objects, each identified by an integer registry -Holds a Registry instance so that we can interact with the event queue in mio next_id -Stores the next available ID so that we can track which event occurred and which Waker should be woken The implementation of Reactor is actually quite simple. It's only four short methods for interacting with the Reactor instance, so I'll present them all here and give a brief explanation next: ch08/b-reactor-executor/src/runtime/reactor. rs impl Reactor { pub fn register(&self, stream: &mut Tcp Stream, interest: Interest, id: usize) { self. registry. register(stream, Token(id), interest). unwrap(); } pub fn set_waker(&self, waker: &Waker, id: usize) { let _ = self . wakers . lock() . map(|mut w| w. insert(id, waker. clone()). is_none()) . unwrap(); } pub fn deregister(&self, stream: &mut Tcp Stream, id: usize) { self. wakers. lock(). map(|mut w| w. remove(&id)). unwrap();