Closed Tortoaster closed 2 years ago
Thanks for the PR @Tortoaster!
You mentioned GATs not being available as the reason Info was a parameter, but I'm not sure why, as I didn't use GATs here.
i might have crossed wires commenting on things but, associated type bounds was what i was going for. the trick that lets us make traits generic over a future without boxing, like:
pub trait AsyncTransmit<'a, E> {
type Output: Future<Output=Result<(), AsyncError<E>>>;
...
}
you might always have been able to do the simple version, it's been a while and i can't quite remember where the issues were prior to at least part of this landing 😂
the PR looks good, though i have already made this change (with a bit of other houscleaning) over in https://github.com/rust-iot/radio-hal/pull/13. given that's already been reviewed i've tagged you as a co-author over there, hope that's alright and doesn't dissuade you from making other contributions ^_^
This PR moves the
ReceiveInfo
fromReceive
'sget_received
method from its parameters to the return type. Originally, one would need to createInfo::default()
and then haveget_received
alter it. Now,get_received
has to create theInfo
itself. This removes the need for aDefault
trait bound, and simplifies the caller code a bit.You mentioned GATs not being available as the reason
Info
was a parameter, but I'm not sure why, as I didn't use GATs here. :grin:As such, take this PR with a grain of salt for now, but I would love to know how it can be improved!