diff options
| author | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:15:44 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2022-06-12 22:22:31 +0200 |
| commit | a8703b75988e1e700af701116464025679d2feb8 (patch) | |
| tree | f4ec5de70ec05e793a774049e010935ac45853ed /examples/std/src/serial_port.rs | |
| parent | 6199bdea710cde33e5d5381b6d6abfc8af46df19 (diff) | |
Run rustfmt.
Diffstat (limited to 'examples/std/src/serial_port.rs')
| -rw-r--r-- | examples/std/src/serial_port.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/std/src/serial_port.rs b/examples/std/src/serial_port.rs index 6825cbebc..c41abd4d0 100644 --- a/examples/std/src/serial_port.rs +++ b/examples/std/src/serial_port.rs | |||
| @@ -1,18 +1,16 @@ | |||
| 1 | use std::io; | ||
| 2 | use std::os::unix::io::{AsRawFd, RawFd}; | ||
| 3 | |||
| 1 | use nix::errno::Errno; | 4 | use nix::errno::Errno; |
| 2 | use nix::fcntl::OFlag; | 5 | use nix::fcntl::OFlag; |
| 3 | use nix::sys::termios; | 6 | use nix::sys::termios; |
| 4 | use std::io; | ||
| 5 | use std::os::unix::io::{AsRawFd, RawFd}; | ||
| 6 | 7 | ||
| 7 | pub struct SerialPort { | 8 | pub struct SerialPort { |
| 8 | fd: RawFd, | 9 | fd: RawFd, |
| 9 | } | 10 | } |
| 10 | 11 | ||
| 11 | impl SerialPort { | 12 | impl SerialPort { |
| 12 | pub fn new<P: ?Sized + nix::NixPath>( | 13 | pub fn new<P: ?Sized + nix::NixPath>(path: &P, baudrate: termios::BaudRate) -> io::Result<Self> { |
| 13 | path: &P, | ||
| 14 | baudrate: termios::BaudRate, | ||
| 15 | ) -> io::Result<Self> { | ||
| 16 | let fd = nix::fcntl::open( | 14 | let fd = nix::fcntl::open( |
| 17 | path, | 15 | path, |
| 18 | OFlag::O_RDWR | OFlag::O_NOCTTY | OFlag::O_NONBLOCK, | 16 | OFlag::O_RDWR | OFlag::O_NOCTTY | OFlag::O_NONBLOCK, |
