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§
Sourcefn _get_cached_socket(
&self,
desc: &ZMQSocketDescription,
) -> Option<ZMQSocketArc>
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
Sourcefn _set_cached_socket(
&mut self,
desc: &ZMQSocketDescription,
sock: Socket,
) -> Fallible<()>
fn _set_cached_socket( &mut self, desc: &ZMQSocketDescription, sock: Socket, ) -> Fallible<()>
Save a socket to the cache, use only in the trait implementation
Sourcefn get_open_sockets(&self) -> Vec<ZMQSocketArc> ⓘ
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§
Sourcefn close_all_sockets(&self) -> Fallible<()>
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.
Sourcefn get_socket(&mut self, desc: &ZMQSocketDescription) -> Fallible<ZMQSocketArc>
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.