[][src]Struct poller::Poller

pub struct Poller { /* fields omitted */ }

定义文件 I/O 事件通知器。

Methods

impl Poller[src]

pub fn new() -> Self[src]

创建一个新的 I/O 事件通知器。

pub fn add(&mut self, fd: i32, events: Events) -> Result<(), SysError>[src]

添加一个文件描述符到监视列表中。

pub fn remove(&mut self, fd: i32) -> Result<(), SysError>[src]

将一个文件描述符从监视列表中移除。

pub fn pull_events(
    &self,
    timeout_ms: i32
) -> Result<Vec<(i32, Events)>, SysError>
[src]

拉取所有被监测到的 I/O 事件。

Examples

let mut poller = Poller::new();
poller.add(0, Events::new().with_read());
for (fd, events) in poller.pull_events(1000).unwrap().iter() {
    println!("Fd={}, Events={}", fd, events);
}

Trait Implementations

impl Debug for Poller[src]

impl Default for Poller[src]

impl Drop for Poller[src]

Auto Trait Implementations

impl RefUnwindSafe for Poller

impl Send for Poller

impl Sync for Poller

impl Unpin for Poller

impl UnwindSafe for Poller

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.