-
Notifications
You must be signed in to change notification settings - Fork 205
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
embedded-can/src/asynch.rs
Outdated
|
||
/// 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 |
@adamgreig in the interest of getting this through so it can start being used downstream, I've removed the |
Thanks for the prompt and the update. I'll add this to the agenda for discussion in the weekly meeting this Tues. |
embedded-can/src/lib.rs
Outdated
// We don't immediately remove them to not immediately break older nightlies. | ||
// When all features are stable, we'll remove them. | ||
#![cfg_attr(nightly, allow(stable_features, unknown_lints))] | ||
#![cfg_attr(nightly, feature(async_fn_in_trait, impl_trait_projections))] |
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.
these cfg_attrs do nothing without this in build.rs.
These were for compat with older nightlies before AFIT was stable. Now that AFIT has been stable for a few rust versions since 1.75, i'd just not put them, and support stable 1.75+ only.
This reverts commit 81bc367.
b8f8ec1
to
37f4be6
Compare
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.