use crate::config::*; use zmq; const ZMQPROTO: &str = "tcp"; pub async fn zconnect(zmqcfg: &ZMQ, zmqtype: zmq::SocketType) -> Result { let zctx = zmq::Context::new(); let zmqhost = &zmqcfg.hostname; let zmqport = zmqcfg.port; let socket = zctx.socket(zmqtype).unwrap(); let connectstring = format!("{ZMQPROTO}://{zmqhost}:{zmqport}"); socket.connect(&connectstring.as_str())?; Ok(socket) }