File: open_port.rs

package info (click to toggle)
rust-serial 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 104 kB
  • sloc: makefile: 4
file content (16 lines) | stat: -rw-r--r-- 360 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
extern crate serial;

#[cfg(unix)]
fn main() {
    use std::path::Path;

    serial::open("/dev/ttyUSB0").unwrap();
    serial::open(Path::new("/dev/ttyUSB0")).unwrap();
    serial::unix::TTYPort::open(Path::new("/dev/ttyUSB0")).unwrap();
}

#[cfg(windows)]
fn main() {
    serial::open("COM1").unwrap();
    serial::windows::COMPort::open("COM1").unwrap();
}