Skip to main content

PollBackend

Trait PollBackend 

Source
pub trait PollBackend: Send + Sync {
    // Required methods
    fn register(
        &mut self,
        fd: RawFd,
        events: u32,
        client_id: ClientId,
    ) -> Result<()>;
    fn modify(
        &mut self,
        fd: RawFd,
        events: u32,
        client_id: ClientId,
    ) -> Result<()>;
    fn unregister(&mut self, fd: RawFd) -> Result<()>;
    fn wait(
        &mut self,
        timeout: Option<f64>,
    ) -> Result<Vec<(RawFd, u32, ClientId)>>;
    fn name(&self) -> &str;
}
Expand description

Trait for I/O polling backends.

This trait abstracts the underlying polling mechanism (epoll, kqueue, poll, etc.) and allows for different implementations without changing the core Engine logic.

Required Methods§

Source

fn register( &mut self, fd: RawFd, events: u32, client_id: ClientId, ) -> Result<()>

Register a file descriptor for events

§Arguments
  • fd - The file descriptor to register
  • events - Event bitmask (E_READ, E_WRITE)
  • client_id - The client ID associated with this fd
Source

fn modify(&mut self, fd: RawFd, events: u32, client_id: ClientId) -> Result<()>

Modify event registration for a file descriptor

Source

fn unregister(&mut self, fd: RawFd) -> Result<()>

Unregister a file descriptor

Source

fn wait(&mut self, timeout: Option<f64>) -> Result<Vec<(RawFd, u32, ClientId)>>

Wait for events with optional timeout (in seconds)

Returns a list of (fd, events, client_id) tuples for ready events

Source

fn name(&self) -> &str

Get the backend name

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§