pub fn read_all_ports(&mut self) -> HashMap<String, Result<Vec<u8>>> {
    let mut buffer = vec![0; 4096];
    let mut map = HashMap::new();
    for (port_name, open_port) in self.open_ports.iter_mut() {
      match open_port.read_port(buffer.as_mut_slice()) {
        Ok(bytes_read) => {
          if bytes_read == 0 {
            // EOF
            info!("Received EOF reading from port {}", port_name);
            map.insert(
              port_name.to_string(),
              Err(ErrorKind::PortEOFError(port_name.clone()).into()),
            );
          } else {
            let bytes = buffer[0..bytes_read].to_vec();
            map.insert(port_name.to_string(), Ok(bytes));
          }
        }
        Err(e) => {
          // debug!("Error {} reading from port {}", e, port_name);
          match e.description() {
            "Operation timed out" => {}
            _ => {
              map.insert(port_name.to_string(), Err(e.into()));
            }
          }
        }
      }
    }
    map
  }
/// Read all currently open ports, return a hashmap of
/// ports to Result<Vec<u8>>
Read all currently open ports, return a hashmap of
ports to Result>
Read all currently open ports return a hashmap of ports to Result >
pub fn read_all_ports(&mut self) -> HashMap<String, Result<Vec<u8>>> {
    let mut buffer = vec![0; 4096];
    let mut map = HashMap::new();
    for (port_name, open_port) in self.open_ports.iter_mut() {
      match open_port.read_port(buffer.as_mut_slice()) {
        Ok(bytes_read) => {
          if bytes_read == 0 {
            // EOF
            info!("Received EOF reading from port {}", port_name);
            map.insert(
              port_name.to_string(),
              Err(ErrorKind::PortEOFError(port_name.clone()).into()),
            );
          } else {
            let bytes = buffer[0..bytes_read].to_vec();
            map.insert(port_name.to_string(), Ok(bytes));
          }
        }
        Err(e) => {
          // debug!("Error {} reading from port {}", e, port_name);
          match e.description() {
            "Operation timed out" => {}
            _ => {
              map.insert(port_name.to_string(), Err(e.into()));
            }
          }
        }
      }
    }
    map
  }
pub fn read_all_ports ( & mut self ) -> HashMap < String , Result < Vec < u8 > > > { let mut buffer = vec ! [ 0 4096 ] ; let mut map = HashMap :: new ( ) ; for ( port_name , open_port ) in self . open_ports . iter_mut ( ) { match open_port . read_port ( buffer . as_mut_slice ( ) ) { Ok ( bytes_read ) => { if bytes_read == 0 { // EOF info ! ( " " port_name ) ; map . insert ( port_name . to_string ( ) , Err ( ErrorKind :: PortEOFError ( port_name . clone ( ) ) . into ( ) ) , ) ; } else { let bytes = buffer [ 0 .. bytes_read ] . to_vec ( ) ; map . insert ( port_name . to_string ( ) , Ok ( bytes ) ) ; } } Err ( e ) => { // debug!("Error {} reading from port {}", e, port_name); match e . description ( ) { " " => { } _ => { map . insert ( port_name . to_string ( ) , Err ( e . into ( ) ) ) ; } } } } } map }
Read all currently open ports, return a hashmap of
ports to Result<Vec<u8>>
Read all currently open ports return a hashmap of ports to Result<Vec<u8 >>
&mut self
&mut self