Open andrewgazelka opened 2 years ago
@eldruin @thalesfragoso any thoughts?
Sorry, I haven't had the time to review this yet. However, I would like to say that I agree with the underlying reasoning and I know that tokio-uring
has something similar, so maybe it's worth checking it, even if it's just to compare to.
Depends on #19
Add a means for taking a slice of a buffer. I think the reasoning for this is best explained by the documentation I have written.
A [BufferSlice] is a slice which wraps either a [ReadBuffer] or a [WriteBuffer]
(0, len]
, wherelen
is the length of the original bufferUse Case Many HALs use the length of a {Read,Write}Buffer to configure DMA Transfers. However, changing the length of the buffer can be complicated. For instance, consider the case where we want to change the length of a slice for a DMA transfer:
Considerations
into_buffer_slice
or not?let buf_slice = (&BUF).into_buffer_slice(123..);
since we have to add ()'s around&BUF
into_buffer_slice
implemented for Read and Write Buffers, not for all sized structs? We could instead have methodsinto_{write, read}_buffer_slice
.