Skip to main content

EventHandler

Trait EventHandler 

Source
pub trait EventHandler: Send + Sync {
    // Provided methods
    fn ev_start(&mut self, _worker: &dyn Any) { ... }
    fn ev_pickup(&mut self, _worker: &dyn Any, _node: &str) { ... }
    fn ev_read(
        &mut self,
        _worker: &dyn Any,
        _node: &str,
        _sname: &str,
        _msg: &str,
    ) { ... }
    fn ev_error(&mut self, _worker: &dyn Any) { ... }
    fn ev_written(
        &mut self,
        _worker: &dyn Any,
        _node: &str,
        _sname: &str,
        _size: usize,
    ) { ... }
    fn ev_hup(&mut self, _worker: &dyn Any, _node: &str, _rc: i32) { ... }
    fn ev_close(&mut self, _worker: &dyn Any, _timedout: bool) { ... }
    fn _ev_routing(&mut self, _worker: &dyn Any, _arg: &str) { ... }
    fn ev_msg(&mut self, _port: u16, _msg: &str) { ... }
    fn ev_timer(&mut self, _timer: &dyn Any) { ... }
}
Expand description

Trait for handling worker lifecycle events.

Implement any subset of these methods to react to events from workers and tasks. All methods have default no-op implementations.

Provided Methods§

Source

fn ev_start(&mut self, _worker: &dyn Any)

Called to indicate that a worker has just started.

Source

fn ev_pickup(&mut self, _worker: &dyn Any, _node: &str)

Called for each node to indicate that a worker command for a specific node (or key) has just started.

Source

fn ev_read(&mut self, _worker: &dyn Any, _node: &str, _sname: &str, _msg: &str)

Called to indicate that a worker has data to read from a specific node (or key).

Source

fn ev_error(&mut self, _worker: &dyn Any)

Called to indicate that a worker has error to read on stderr from a specific node (or key).

DEPRECATED: use ev_read instead and check if sname is ‘stderr’

Source

fn ev_written( &mut self, _worker: &dyn Any, _node: &str, _sname: &str, _size: usize, )

Called to indicate that some writing has been done by the worker to a node on a given stream.

Source

fn ev_hup(&mut self, _worker: &dyn Any, _node: &str, _rc: i32)

Called for each node to indicate that a worker command for a specific node has just finished.

Source

fn ev_close(&mut self, _worker: &dyn Any, _timedout: bool)

Called to indicate that a worker has just finished.

Source

fn _ev_routing(&mut self, _worker: &dyn Any, _arg: &str)

Routing event (private). Called to indicate that a (meta)worker has just updated one of its route path.

Source

fn ev_msg(&mut self, _port: u16, _msg: &str)

Called to indicate that a message has been received on an EnginePort.

Source

fn ev_timer(&mut self, _timer: &dyn Any)

Called to indicate that a timer is firing.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§