diff --git a/CHANGELOG.md b/CHANGELOG.md index ae086834..3407de07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ project adheres to [Semantic Versioning](https://semver.org/). ## [Unreleased] ### Added + +* Add `IntoRawHandle` implementation for `COMPort` + [#199](https://github.com/serialport/serialport-rs/pull/199) + ### Changed ### Fixed ### Removed diff --git a/src/windows/com.rs b/src/windows/com.rs index 0985bf5d..20e243fb 100644 --- a/src/windows/com.rs +++ b/src/windows/com.rs @@ -176,6 +176,14 @@ impl FromRawHandle for COMPort { } } +impl IntoRawHandle for COMPort { + fn into_raw_handle(self) -> RawHandle { + let Self { handle, .. } = self; + + handle as RawHandle + } +} + impl io::Read for COMPort { fn read(&mut self, buf: &mut [u8]) -> io::Result { let mut len: DWORD = 0;