Expect that nusb::transfer::Buffer expose more APIs
#173
-
|
Hello, nice to see nusb version 0.2.1 which I think is easy to use. After a simple tryout, two major issues confused me.
Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Beta Was this translation helpful? Give feedback.
-
|
Btw, as just tested on my Win11 system, it seem that I feel that sometimes the transfer may be short (e.g, 16 or 32 bytes), so I wonder why it is designed like this, or would it possible to relax the restriction? |
Beta Was this translation helpful? Give feedback.
BufferimplementsDeref<Target = [u8]>. You can callbuffer.deref()to get a&[u8]. In most cases you can just treat theBufferas if it were aVecalready.Vecback into aBufferany more, so this is no longer a concern. If you want to reuse a buffer you just keep it as aBuffer.