Closed jneem closed 1 year ago
That would probably not hurt but also need some changes to actually report the error to the central device
I had a go at the fallible part of this, but async was trickier than I expected because most (all?) usage of AttData
is via &dyn AttData
, so slapping async
on the methods won't work. I think this can be worked around by something like
trait AsyncAttData {
fn read<'self>(&'self mut self, offset: usize, data: &mut [u8]) -> Pin<&'self mut dyn Future<Output=Result<usize, AttErrorCode>>>;
}
but then implementing AsyncAttData
gets more painful and I start to wonder whether it's worth the effort...
but then implementing AsyncAttData gets more painful and I start to wonder whether it's worth the effort...
I agree - it's probably not worth the effort for now 👍
fixed by #15
Would you be interested in generalizing
AttData
to allow errors and futures? The errors would involve changingAttData
to be likeThe async version might have to involve another trait, like
bleps::async_attribute::Attribute
or something.You could still of course implement
AttData
forFnMut(usize, &[u8])
and similar, so it probably wouldn't cause much breakage.