pub struct Reactor {
pub events: Arc<Mutex<HashMap<String, Waker>>>,
}
Expand description
The Reactor struct stores event references for the events currently being waited on
This collection is safe to access across thread boundaries as we have wrapped with an Arc
to satisfy borrowing the value across threads and it is also wrapped in a Mutex
to ensure that only one thread can write to it at a time
Safety: We must make sure when a job is prematurely cancelled we drop any events being waited on
We could do this by implementing the drop trait on the Job
Fields§
§events: Arc<Mutex<HashMap<String, Waker>>>
A dictionary of events where the key is a unique identifier to the event
and the value contains a struct
with a mechanism to resume the future
Implementations§
Auto Trait Implementations§
impl Freeze for Reactor
impl RefUnwindSafe for Reactor
impl Send for Reactor
impl Sync for Reactor
impl Unpin for Reactor
impl UnwindSafe for Reactor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more