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
Add async API for CAN #585
base: master
Are you sure you want to change the base?
Add async API for CAN #585
Conversation
|
||
/// Tries to put a frame in the transmit buffer. | ||
/// If no space is available in the transmit buffer `None` is returned. | ||
fn try_transmit(&mut self, frame: &Self::Frame) -> Option<Result<(), Self::Error>>; |
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.
Strange signature.
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.
Inspired by a pattern I've seen around like here: https://docs.rs/rtic-sync/latest/rtic_sync/arbiter/struct.Arbiter.html
Can just get rid of it, but I think it's useful.
Thanks for the PR! We had a brief discussion about it in the weekly meeting today. Having the trait in the It looks like either the crate's MSRV (and related CI tests) will need updating, or the trait needs to be gated, to get CI passing, too. |
@adamgreig thanks for the update. I'm still strongly for keeping the try methods. The use case is that when libraries ( It is very similar to the ideas around |
Adds a new CAN trait with both async and fallback non-blocking methods.
Module is named
asynch
to avoid a collision with theasync
keyword. Alternatively a separate crateembedded-can-async
could be published.