Trait io::IoHandler

source ·
pub trait IoHandler<Message>: Send + Sync
where Message: Send + Sync + 'static,
{ // Provided methods fn initialize(&self, _io: &IoContext<Message>) { ... } fn timeout(&self, _io: &IoContext<Message>, _timer: TimerToken) { ... } fn message(&self, _io: &IoContext<Message>, _message: &Message) { ... } fn stream_hup(&self, _io: &IoContext<Message>, _stream: StreamToken) { ... } fn stream_readable(&self, _io: &IoContext<Message>, _stream: StreamToken) { ... } fn stream_writable(&self, _io: &IoContext<Message>, _stream: StreamToken) { ... } fn register_stream( &self, _stream: StreamToken, _reg: Token, _event_loop: &Poll ) { ... } fn update_stream( &self, _stream: StreamToken, _reg: Token, _event_loop: &Poll ) { ... } fn deregister_stream(&self, _stream: StreamToken, _event_loop: &Poll) { ... } }
Expand description

Generic IO handler. All the handler function are called from within IO event loop. Message type is used as notification data

Provided Methods§

source

fn initialize(&self, _io: &IoContext<Message>)

Initialize the handler

source

fn timeout(&self, _io: &IoContext<Message>, _timer: TimerToken)

Timer function called after a timeout created with HandlerIo::timeout.

source

fn message(&self, _io: &IoContext<Message>, _message: &Message)

Called when a broadcasted message is received. The message can only be sent from a different IO handler.

source

fn stream_hup(&self, _io: &IoContext<Message>, _stream: StreamToken)

Called when an IO stream gets closed

source

fn stream_readable(&self, _io: &IoContext<Message>, _stream: StreamToken)

Called when an IO stream can be read from

source

fn stream_writable(&self, _io: &IoContext<Message>, _stream: StreamToken)

Called when an IO stream can be written to

source

fn register_stream(&self, _stream: StreamToken, _reg: Token, _event_loop: &Poll)

Register a new stream with the event loop

source

fn update_stream(&self, _stream: StreamToken, _reg: Token, _event_loop: &Poll)

Re-register a stream with the event loop

source

fn deregister_stream(&self, _stream: StreamToken, _event_loop: &Poll)

Deregister a stream. Called when stream is removed from event loop

Implementors§