You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have usage to write chunks from BoundedBuf like below
use tokio_uring::buf::BoundedBuf;fnwrite_boundedbuf<B:BoundedBuf>(buf:B) -> (usize,B){todo!();}fnchunk_write_boundedbuf<B>(buf:B)whereB:BoundedBuf,
<BasBoundedBuf>::Bounds:Clone,{let chunk_size = 2;let total = buf.bytes_init();let bounds = buf.bounds();letmut slice = buf.slice(..);letmut written = 0;while written < total {
slice = slice.into_inner().slice(bounds.clone()).slice(written..);let(n, new) = write_boundedbuf(slice.slice(..chunk_size));
slice = new;
written += n;}}
In fact, what I want is to write chunks from a whole buffer. In slice case, it's just
fnwrite(buf:&[u8]) -> usize{todo!();}fnchunk_write(buf:&[u8]){for chunk in buf.chunks(2){write(chunk);}}
The boundedBuf usage is not only very verbose but also error prune. Can we have additional functions in https://doc.rust-lang.org/std/slice/index.html (to be specific, Chunks for our case)?
The text was updated successfully, but these errors were encountered:
We have usage to write chunks from BoundedBuf like below
In fact, what I want is to write chunks from a whole buffer. In slice case, it's just
The boundedBuf usage is not only very verbose but also error prune. Can we have additional functions in https://doc.rust-lang.org/std/slice/index.html (to be specific,
Chunks
for our case)?The text was updated successfully, but these errors were encountered: