Skip to main content

AsyncFileRead

Trait AsyncFileRead 

Source
pub trait AsyncFileRead: Send + Sync {
    // Required methods
    fn len(&self) -> u64;
    fn read_bytes_range<'life0, 'async_trait>(
        &'life0 self,
        range: Range<u64>,
    ) -> Pin<Box<dyn Future<Output = Result<OwnedBytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn read_bytes<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<OwnedBytes>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Trait for async range reading - implemented by both FileSlice and LazyFileHandle

Required Methods§

Source

fn len(&self) -> u64

Get the total length of the file/slice (u64 to support >4GB files on 32-bit platforms)

Source

fn read_bytes_range<'life0, 'async_trait>( &'life0 self, range: Range<u64>, ) -> Pin<Box<dyn Future<Output = Result<OwnedBytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read a specific byte range

Provided Methods§

Source

fn is_empty(&self) -> bool

Check if empty

Source

fn read_bytes<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<OwnedBytes>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read all bytes

Implementors§