Skip to main content

AioSource

Trait AioSource 

Source
pub trait AioSource {
    // Required method
    fn deregister(&mut self);

    // Provided methods
    fn register(&mut self, _kq: RawFd, _token: usize) { ... }
    fn register_borrowed(&mut self, kq: BorrowedFd<'_>, token: usize) { ... }
}
Available on FreeBSD and crate feature net only.
Expand description

Like [mio::event::Source], but for POSIX AIO only.

Tokio’s consumer must pass an implementor of this trait to create a Aio object. Implementors must implement at least one of AioSource::register and AioSource::register_borrowed.

Required Methods§

Source

fn deregister(&mut self)

Deregisters this AIO event source with Tokio’s reactor.

Provided Methods§

Source

fn register(&mut self, _kq: RawFd, _token: usize)

👎Deprecated since 1.52.0:

use register_borrowed instead

Registers this AIO event source with Tokio’s reactor.

§Safety

It’s memory-safe, but not I/O safe. If the file referenced by kq gets dropped, then this source may end up notifying the wrong file.

Source

fn register_borrowed(&mut self, kq: BorrowedFd<'_>, token: usize)

Registers this AIO event source with Tokio’s reactor.

Implementors§