pub struct BytesSource(pub Arc<[u8]>);Expand description
An in-memory AsyncSource (tests, already-buffered bodies).
Tuple Fields§
§0: Arc<[u8]>Trait Implementations§
Source§impl AsyncSource for BytesSource
impl AsyncSource for BytesSource
Source§async fn read_at(
&mut self,
offset: u64,
out: &mut [u8],
) -> Result<usize, BoxedError>
async fn read_at( &mut self, offset: u64, out: &mut [u8], ) -> Result<usize, BoxedError>
Read up to
out.len() bytes at offset into out and return the
count. Like AsyncRead, a read may return fewer bytes than asked:
whatever has arrived, so a decoder can start on it. Zero means the
source ends at offset.Source§async fn len(&mut self) -> Result<u64, BoxedError>
async fn len(&mut self) -> Result<u64, BoxedError>
Total length. Sequential sources can only answer once they reached
the end; they return an error before that.
Source§fn read_ranges(
&mut self,
reqs: &mut [(u64, &mut [u8])],
) -> impl Future<Output = Result<(), BoxedError>> + Send
fn read_ranges( &mut self, reqs: &mut [(u64, &mut [u8])], ) -> impl Future<Output = Result<(), BoxedError>> + Send
Fill each buffer from its offset. Sources that can serve ranges
concurrently (HTTP/2, object stores) override this to overlap them;
the default reads them one after another.
Source§impl Clone for BytesSource
impl Clone for BytesSource
Source§fn clone(&self) -> BytesSource
fn clone(&self) -> BytesSource
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for BytesSource
impl RefUnwindSafe for BytesSource
impl Send for BytesSource
impl Sync for BytesSource
impl Unpin for BytesSource
impl UnsafeUnpin for BytesSource
impl UnwindSafe for BytesSource
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more