pub trait EngineClient: Send {
// Required methods
fn start(&mut self) -> Result<()>;
fn close(&mut self, abort: bool, timeout: bool);
fn fd(&self) -> Option<RawFd>;
fn events(&self) -> u32;
fn is_delayable(&self) -> bool;
fn is_registered(&self) -> bool;
fn set_registered(&mut self, val: bool);
fn autoclose(&self) -> bool;
// Provided methods
fn handle_read(&mut self) -> Result<usize> { ... }
fn handle_write(&mut self) -> Result<usize> { ... }
}Expand description
Trait for objects that can be managed by the Engine.
Clients are I/O objects (files, sockets, pipes) that the engine monitors for readability/writability and manages through their lifecycle.
Required Methods§
Sourcefn close(&mut self, abort: bool, timeout: bool)
fn close(&mut self, abort: bool, timeout: bool)
Close the client
§Arguments
abort- Whether this is an abort closetimeout- Whether this is a timeout close
Sourcefn is_delayable(&self) -> bool
fn is_delayable(&self) -> bool
Check if this client can be delayed (batched)
Sourcefn is_registered(&self) -> bool
fn is_registered(&self) -> bool
Check if this client is currently registered with the engine
Sourcefn set_registered(&mut self, val: bool)
fn set_registered(&mut self, val: bool)
Set the registered state
Provided Methods§
Sourcefn handle_read(&mut self) -> Result<usize>
fn handle_read(&mut self) -> Result<usize>
Handle a read event on this client. Returns the number of bytes read, or 0 on EOF.
Sourcefn handle_write(&mut self) -> Result<usize>
fn handle_write(&mut self) -> Result<usize>
Handle a write event on this client. Returns the number of bytes written.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".