We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
try
From the example on the home page: https://github.com/dcuddeback/serial-rs/tree/master/serial
rustc -V --> rustc 1.72.1
Compiling rust_serial v0.1.0 (C:\Users\r\GitHub\rust_serial) error: use of deprecated `try` macro --> src\main.rs:18:5 | 18 | / try!(port.reconfigure(&|settings| { 19 | | try!(settings.set_baud_rate(serial::Baud9600)); 20 | | settings.set_char_size(serial::Bits8); 21 | | settings.set_parity(serial::ParityNone); ... | 24 | | Ok(()) 25 | | })); | |_______^ | = note: in the 2018 edition `try` is a reserved keyword, and the `try!()` macro is deprecated help: you can use the `?` operator instead
The text was updated successfully, but these errors were encountered:
extern crate serial; use std::env; use std::io; use std::time::Duration; use std::io::prelude::*; use serial::prelude::*; fn main() { for arg in env::args_os().skip(1) { let mut port = serial::open(&arg).unwrap(); interact(&mut port).unwrap(); } } fn interact<T: SerialPort>(port: &mut T) -> io::Result<()> { port.reconfigure(&|settings| { settings.set_baud_rate(serial::Baud9600)?; settings.set_char_size(serial::Bits8); settings.set_parity(serial::ParityNone); settings.set_stop_bits(serial::Stop1); settings.set_flow_control(serial::FlowNone); Ok(()) })?; port.set_timeout(Duration::from_millis(1000))?; let mut buf: Vec<u8> = (0..255).collect(); port.write(&buf[..])?; port.read(&mut buf[..])?; Ok(()) }
Use the ? operator
Sorry, something went wrong.
No branches or pull requests
From the example on the home page: https://github.com/dcuddeback/serial-rs/tree/master/serial
rustc -V --> rustc 1.72.1
The text was updated successfully, but these errors were encountered: