Spec-Zone.ru › Tokio

Trait AioSource

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.

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

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

Required Methods

fn deregister(&mut self)

Deregisters this AIO event source with Tokio’s reactor.

Provided Methods

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.

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

Registers this AIO event source with Tokio’s reactor.

Dyn Compatibility

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors

MIT License
Copyright © Tokio Contributors
https://docs.rs/tokio/1.53.1/tokio/io/bsd/trait.AioSource.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API