I'd like to connect Controller to something which implements Read and Write. The tedious part of this is Controller::peek(usize), because you need to implement a small "peekable" buffer which applies to read_into as well.
peek feels like an implementation detail which bluetooth-hci could handle itself, so then you only would need to implement read_into. It also means bluetooth-hci can make this buffer as large or as small as needed.
BlueNRG has a buffer implementation which doesn't appear specific to this device:
I'd like to connect
Controller
to something which implements Read and Write. The tedious part of this isController::peek(usize)
, because you need to implement a small "peekable" buffer which applies toread_into
as well.peek
feels like an implementation detail whichbluetooth-hci
could handle itself, so then you only would need to implementread_into
. It also meansbluetooth-hci
can make this buffer as large or as small as needed.BlueNRG has a buffer implementation which doesn't appear specific to this device:
https://github.com/danielgallagher0/bluenrg/blob/e5cbecfe3d63bb24a346ff91221041bf9267ec0f/src/lib.rs#L375