pub trait RangeReader:
Sync
+ Send
+ Unpin {
// Required methods
fn metadata<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Metadata>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read<'life0, 'async_trait>(
&'life0 self,
range: Range<u64>,
) -> Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn read_into<'life0, 'life1, 'async_trait>(
&'life0 self,
range: Range<u64>,
buf: &'life1 mut (impl 'async_trait + BufMut + Send),
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn read_vec<'life0, 'life1, 'async_trait>(
&'life0 self,
ranges: &'life1 [Range<u64>],
) -> Pin<Box<dyn Future<Output = Result<Vec<Bytes>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}
Expand description
RangeReader
reads a range of bytes from a source.
Required Methods§
Provided Methods§
sourcefn read_into<'life0, 'life1, 'async_trait>(
&'life0 self,
range: Range<u64>,
buf: &'life1 mut (impl 'async_trait + BufMut + Send),
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_into<'life0, 'life1, 'async_trait>(
&'life0 self,
range: Range<u64>,
buf: &'life1 mut (impl 'async_trait + BufMut + Send),
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the bytes in the given range into the buffer.
Handles the buffer based on its capacity:
- If the buffer is insufficient to hold the bytes, it will either:
- Allocate additional space (e.g., for
Vec<u8>
) - Panic (e.g., for
&mut [u8]
)
- Allocate additional space (e.g., for
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.