pub struct ReadinessInterestTable {
next_watcher_id: usize,
interests: BTreeMap<FdId, Vec<(usize, Weak<ReadinessWatcher>)>>,
}Expand description
The table with all ReadinessWatchers.
This tracks, for each file description, which watchers have an interest in events
for this file description.
Fields§
§next_watcher_id: usizeThe id of the next ReadinessWatcher created through
ReadinessInterestTable::new_watcher.
interests: BTreeMap<FdId, Vec<(usize, Weak<ReadinessWatcher>)>>Maps each file description (identified by its FdId) to the list of watchers that are
interested in that FD. We also store the ReadinessWatchers ID
separately so we can access it without calling upgrade. The list
is sorted by that id. We use an ID so that we can identify the watcher even after it has
been moved, e.g. in ReadinessWatcher::destroy.
Implementations§
Source§impl ReadinessInterestTable
impl ReadinessInterestTable
pub(crate) fn new() -> Self
Sourcepub fn new_watcher(&mut self) -> ReadinessWatcher
pub fn new_watcher(&mut self) -> ReadinessWatcher
Create a new ReadinessWatcher with a globally unique id.
Every watcher gets a sequentially increasing id such that no two
watchers ever get the same id.
Sourcefn insert(&mut self, fd_id: FdId, watcher: &Rc<ReadinessWatcher>)
fn insert(&mut self, fd_id: FdId, watcher: &Rc<ReadinessWatcher>)
Add an interest for watcher for the file description with id fd_id.
Sourcefn remove(&mut self, fd_id: FdId, watcher: &ReadinessWatcher)
fn remove(&mut self, fd_id: FdId, watcher: &ReadinessWatcher)
Remove the interest of watcher for the file description with id fd_id.
Sourcefn get_watchers_for_fd(
&self,
fd_id: FdId,
) -> Option<impl Iterator<Item = Rc<ReadinessWatcher>>>
fn get_watchers_for_fd( &self, fd_id: FdId, ) -> Option<impl Iterator<Item = Rc<ReadinessWatcher>>>
Get all watchers which have a registered interest in the file description
with id fd_id.
Sourcepub fn remove_watchers_for_fd(&mut self, fd_id: FdId)
pub fn remove_watchers_for_fd(&mut self, fd_id: FdId)
Remove all watchers for the file description with id fd_id.
Auto Trait Implementations§
impl !RefUnwindSafe for ReadinessInterestTable
impl !Send for ReadinessInterestTable
impl !Sync for ReadinessInterestTable
impl !UnwindSafe for ReadinessInterestTable
impl Freeze for ReadinessInterestTable
impl Unpin for ReadinessInterestTable
impl UnsafeUnpin for ReadinessInterestTable
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
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes