Skip to main content

## ReadinessInterestTable

# Struct ReadinessInterestTable

Source

    pub struct ReadinessInterestTable {
        next_watcher_id: usize,
        interests: BTreeMap<FdId, Vec<(usize, Weak<ReadinessWatcher>)>>,
    }

Expand description

The table with all `ReadinessWatcher`s. This tracks, for each file description, which watchers have an interest in events for this file description.

## Fields§

§`next_watcher_id: usize`

The 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 `ReadinessWatcher`s 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

Source

#### pub(crate) fn new() -> Self

Source

#### 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.

Source

#### fn insert(&mut self, fd_id: FdId, watcher: &Rc<ReadinessWatcher>)

Add an interest for `watcher` for the file description with id `fd_id`.

Source

#### fn remove(&mut self, fd_id: FdId, watcher: &ReadinessWatcher)

Remove the interest of `watcher` for the file description with id `fd_id`.

Source

#### 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`.

Source

#### 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> Any for T
where T: 'static + ?Sized,

Source§

#### fn type_id(&self) -> TypeId

Gets the `TypeId` of `self`. Read more
Source§

### impl<T> Borrow<T> for T
where T: ?Sized,

Source§

#### fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

### impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

#### fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

### impl<T> From<T> for T

Source§

#### fn from(t: T) -> T

Returns the argument unchanged.

Source§

### impl<T, U> Into<U> for T
where U: From<T>,

Source§

#### fn into(self) -> U

Calls `U::from(self)`.

That is, this conversion is whatever the implementation of `From<T> for U` chooses to do.

Source§

### impl<T> Same for T

Source§

#### type Output = T

Should always be `Self`
Source§

### impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

#### type Error = Infallible

The type returned in the event of a conversion error.
Source§

#### fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

### impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

#### type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

#### fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.

## 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