There was an error while loading. Please reload this page.
1 parent 5ca6756 commit 2911ed6Copy full SHA for 2911ed6
src/windows/com.rs
@@ -40,7 +40,10 @@ impl COMPort {
40
/// * `InvalidInput` if `port` is not a valid device name.
41
/// * `Io` for any other I/O error while opening or initializing the device.
42
pub fn open<T: AsRef<OsStr> + ?Sized>(port: &T) -> ::Result<Self> {
43
- let mut name: Vec<u16> = port.as_ref().encode_wide().collect();
+ let mut name = Vec::<u16>::new();
44
+
45
+ name.extend(OsStr::new("\\\\.\\").encode_wide());
46
+ name.extend(port.as_ref().encode_wide());
47
name.push(0);
48
49
let handle = unsafe {
0 commit comments