Visitors have accessed this post 249 times.

{
    let mut serial_buf = vec![0u8; 1000];
    println!("Receiving data on {} at {} baud:", &port_name, &baud_rate);
    loop {
        match port.read( serial_buf.as_mut_slice()) {
            Ok(t) => 
            println!("{}", Encoding::ANSI.to_string(&serial_buf[..t]).unwrap()),
            Err(ref e) if e.kind() == io::ErrorKind::TimedOut => (),
            Err(e) => eprintln!("{:?}", e),
        }
    }
}

Добавить комментарий