pub trait Reader:
AsyncRead
+ AsyncSeekForward
+ Unpin
+ Send
+ Sync {
// Provided method
fn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> StackFuture<'a, Result<usize>, STACK_FUTURE_SIZE> ⓘ { ... }
}
Expand description
A type returned from AssetReader::read
, which is used to read the contents of a file
(or virtual file) corresponding to an asset.
This is essentially a trait alias for types implementing AsyncRead
and AsyncSeekForward
.
The only reason a blanket implementation is not provided for applicable types is to allow
implementors to override the provided implementation of Reader::read_to_end
.
Provided Methods§
sourcefn read_to_end<'a>(
&'a mut self,
buf: &'a mut Vec<u8>,
) -> StackFuture<'a, Result<usize>, STACK_FUTURE_SIZE> ⓘ
fn read_to_end<'a>( &'a mut self, buf: &'a mut Vec<u8>, ) -> StackFuture<'a, Result<usize>, STACK_FUTURE_SIZE> ⓘ
Reads the entire contents of this reader and appends them to a vec.
§Note for implementors
You should override the provided implementation if you can fill up the buffer more
efficiently than the default implementation, which calls poll_read
repeatedly to
fill up the buffer 32 bytes at a time.