Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This add support for Windows platform.
I used the
mio-named-pipes
crate to implement that easily without having to copy files frommio
to use structs that are not public.As its name implie, this crate allow to read/write to a named pipe which is basically implemented using
ReadFile
/WriteFile
api just as what we have to use for COM ports.The only difference reside in the way to create that file which is then handled specifically in
Serial::from_path
.This is based on
serialport-2
branch as we need a new function (not merged yet) to create aCOMPort
with a handle directly. Allowing to open the file for asynchronous operations.I'll have to switch to the crates.io serialport when published.
I modified the example to build on Windows too.
As async API is completion-based on Windows, readiness is actually updated only when
read
is actually performed. so we got a lot of"Read would have blocked."
in the output as it is readable even if no bytes are available. That's inherent tomio