diff --git a/CHANGELOG b/CHANGELOG index 3936c49..7eefe56 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +# Unreleased +- [fix][minor] Fix verification of applied settings on iOS and macOS. +- [fix][minor] Allow for a 2.5% deviation in actual baud rate when applying settings on Unix. +- [add][minor] Implement `Debug` for `SerialPort` showing the underlying file descriptor (Unix) or handle (Windows). + # Version 0.1.13 - 2024-06-21 - [add][minor] Support more custom baud rates on iOS and macOS. diff --git a/Cargo.lock b/Cargo.lock index 04ac4f2..200ab66 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "serial2" -version = "0.2.26" +version = "0.2.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f39915da34f43a64c66d53c228b8ba9a4e21fed4894af24304e47f96996acafd" +checksum = "8cd0c773455b60177d1abe4c739cbfa316c4f2f0ef37465befcb72e8a15cdd02" dependencies = [ "cfg-if", "libc", diff --git a/Cargo.toml b/Cargo.toml index 8d99ea3..19c7ebb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ serde = ["serial2/serde"] doc = ["tokio/io-util", "serial2/doc"] [dependencies] -serial2 = "0.2.26" +serial2 = "0.2.28" tokio = { version = "1.32.0", default-features = false, features = ["net"] } [target.'cfg(unix)'.dependencies] diff --git a/src/inner/unix.rs b/src/inner/unix.rs index 1f65c2b..99d0eff 100644 --- a/src/inner/unix.rs +++ b/src/inner/unix.rs @@ -152,3 +152,10 @@ fn check_ret(value: isize) -> std::io::Result { Ok(value as usize) } } + +impl std::fmt::Debug for SerialPort { + #[inline] + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&self.io.get_ref(), f) + } +} diff --git a/src/inner/windows.rs b/src/inner/windows.rs index aae88a0..219c725 100644 --- a/src/inner/windows.rs +++ b/src/inner/windows.rs @@ -140,3 +140,12 @@ impl SerialPort { Poll::Ready(Err(std::io::Error::from_raw_os_error(error as i32))) } } + +impl std::fmt::Debug for SerialPort { + #[inline] + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.with_raw(|serial_port| { + std::fmt::Debug::fmt(serial_port, f) + }) + } +} diff --git a/src/lib.rs b/src/lib.rs index 9d29146..1e41e19 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -372,3 +372,10 @@ impl AsyncWrite for SerialPort { self.get_mut().inner.poll_shutdown(cx) } } + +impl std::fmt::Debug for SerialPort { + #[inline] + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Debug::fmt(&self.inner, f) + } +}