pub trait ByteSource: Send + Sync {
// Required methods
async fn get_size(&self) -> Result<usize, PolarsError>;
async fn get_suffix(
&self,
n: usize,
) -> Result<(Buffer<u8>, usize), PolarsError>;
async fn get_range(
&self,
range: Range<usize>,
) -> Result<Buffer<u8>, PolarsError>;
async fn get_ranges(
&self,
ranges: &mut [Range<usize>],
) -> Result<HashMap<usize, Buffer<u8>, RandomState>, PolarsError>;
}Available on crate features
async and polars-io only.Required Methods§
async fn get_size(&self) -> Result<usize, PolarsError>
Sourceasync fn get_suffix(&self, n: usize) -> Result<(Buffer<u8>, usize), PolarsError>
async fn get_suffix(&self, n: usize) -> Result<(Buffer<u8>, usize), PolarsError>
Fetch the last n bytes and the total size of the source, in a single request. Returns
fewer than n bytes if the source is smaller than n.
Sourceasync fn get_range(
&self,
range: Range<usize>,
) -> Result<Buffer<u8>, PolarsError>
async fn get_range( &self, range: Range<usize>, ) -> Result<Buffer<u8>, PolarsError>
§Panics
Panics if range is not in bounds.
Sourceasync fn get_ranges(
&self,
ranges: &mut [Range<usize>],
) -> Result<HashMap<usize, Buffer<u8>, RandomState>, PolarsError>
async fn get_ranges( &self, ranges: &mut [Range<usize>], ) -> Result<HashMap<usize, Buffer<u8>, RandomState>, PolarsError>
Note: This will mutably sort ranges for coalescing.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl ByteSource for BufferByteSource
impl ByteSource for DynByteSource
impl ByteSource for FileByteSource
impl ByteSource for ObjectStoreByteSource
Available on crate feature
cloud only.