Trait SocketHandler

Source
pub trait SocketHandler {
    // Required methods
    fn _get_cached_socket(
        &self,
        desc: &ZMQSocketDescription,
    ) -> Option<ZMQSocketArc>;
    fn _set_cached_socket(
        &mut self,
        desc: &ZMQSocketDescription,
        sock: Socket,
    ) -> Fallible<()>;
    fn get_open_sockets(&self) -> Vec<ZMQSocketArc> ;

    // Provided methods
    fn close_all_sockets(&self) -> Fallible<()> { ... }
    fn get_socket(
        &mut self,
        desc: &ZMQSocketDescription,
    ) -> Fallible<ZMQSocketArc> { ... }
}
Expand description

Socket tracking, caching etc

Required Methods§

Source

fn _get_cached_socket( &self, desc: &ZMQSocketDescription, ) -> Option<ZMQSocketArc>

Get a socket by desc from cache if it exist, use only in the trait implementation

Source

fn _set_cached_socket( &mut self, desc: &ZMQSocketDescription, sock: Socket, ) -> Fallible<()>

Save a socket to the cache, use only in the trait implementation

Source

fn get_open_sockets(&self) -> Vec<ZMQSocketArc>

Get all open sockets NOTE: because of the rust library all sockets we have are always going to be open

Provided Methods§

Source

fn close_all_sockets(&self) -> Fallible<()>

Close all open sockets, NOTE that for the zmq rust library we don’t get to do this kind of low-level management, the destructor will close things.

Source

fn get_socket(&mut self, desc: &ZMQSocketDescription) -> Fallible<ZMQSocketArc>

Get a socket by description (will be created and put to cache if not there already) bind/connect will be handled automatically by this method.

Implementors§