-
Notifications
You must be signed in to change notification settings - Fork 9
mctp-estack: Add async feature gate, add blocking serial transport binding
#40
New issue
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: leongross <[email protected]> Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: leongross <[email protected]> Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: leongross <[email protected]> Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: leongross <[email protected]> Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: jonas loeffelholz <[email protected]> Signed-off-by: Marvin Gudel <[email protected]>
Signed-off-by: Marvin Gudel <[email protected]>
|
Should the |
mkj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think async makes sense as a default feature. If Router isn't being used then I don't think it would have any binary overhead, just some extra built dependencies for embassy-sync's dep tree.
| A `async` Router for embassy based applications is available | ||
| through the `embassy` feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"through the async feature"
| - `embassy`: async `Router` for [Embassy](https://embassy.dev/) | ||
| - `async`: [embedded-io-async](https://docs.rs/embedded-io-async/0.6.1/embedded_io_async/) serial transport binding (enabled by `embassy` feature) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combined now
| /// Read a frame synchronously. | ||
| /// This function blocks until at least one byte is available | ||
| #[cfg(not(feature = "async"))] | ||
| pub fn recv(&mut self, input: &mut impl Read) -> Result<&[u8]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name it recv_sync() for consistency
| #[cfg(feature = "async")] | ||
| use embedded_io_async::{Read, Write}; | ||
|
|
||
| #[cfg(not(feature = "async"))] | ||
| use embedded_io::{Read, Write}; | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this serial module I'd be inclined to get rid of all the cfg and always include both async and blocking functionality. embedded_io_async is a small dependency.
cfg(not(feature = "async")) shouldn't be used since that prevents a program linking crates that use both modes. (More generally features should always be additive, where possible)
| /// Frame a MCTP packet into a serial frame, writing to `output`. | ||
| #[cfg(feature = "async")] | ||
| async fn frame_to_serial<W>( | ||
| p: &[u8], | ||
| output: &mut W, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need renaming to frame_to_serial_async or similar
Puts async functionality and dependencies behind
asyncfeature gate.The serial transport binding was extended by blocking functionality using
embedded-io.