pub struct Response { /* private fields */ }Expand description
One finished read.
The index is the position the request had in the vector handed to submit, and it is here
because completions do not arrive in submission order. A caller that decodes as answers arrive
has no other way to know which page it is looking at.
Implementations§
Source§impl Response
impl Response
Sourcepub fn new(index: usize, offset: u64, read: usize, buf: Vec<u8>) -> Self
pub fn new(index: usize, offset: u64, read: usize, buf: Vec<u8>) -> Self
A finished read of read bytes into buf.
Sourcepub fn bytes(&self) -> &[u8] ⓘ
pub fn bytes(&self) -> &[u8] ⓘ
The bytes that arrived, which is a prefix of the buffer and not all of it.
Sourcepub fn is_short(&self) -> bool
pub fn is_short(&self) -> bool
Whether fewer bytes arrived than were asked for.
A short read is not an error here for the same reason it is not one in read_at: the end
of the file is a fact about the file and the caller is the one that knows whether it was
expecting to be there. A caller that cannot proceed on a short read says so itself.
Sourcepub fn into_buffer(self) -> Vec<u8> ⓘ
pub fn into_buffer(self) -> Vec<u8> ⓘ
The buffer, taken out of the response so it can be handed to the next request.
The bytes past Self::read are whatever was in the buffer before.