Skip to main content

ReadDyn

Trait ReadDyn 

Source
pub trait ReadDyn:
    Unpin
    + Send
    + Sync {
    // Required methods
    fn open_dyn(
        &self,
        range: BytesRange,
    ) -> Pin<Box<dyn Future<Output = Result<(RpRead, Box<dyn ReadStreamDyn>), Error>> + Send + '_>>;
    fn read_dyn(
        &self,
        range: BytesRange,
    ) -> Pin<Box<dyn Future<Output = Result<(RpRead, Buffer), Error>> + Send + '_>>;
}
Expand description

ReadDyn is the dyn-compatible adapter for Read.

It boxes returned futures to support Box<dyn ReadDyn>, adding one allocation per call at the type-erasure boundary.

Required Methods§

Source

fn open_dyn( &self, range: BytesRange, ) -> Pin<Box<dyn Future<Output = Result<(RpRead, Box<dyn ReadStreamDyn>), Error>> + Send + '_>>

The dyn version of Read::open.

Source

fn read_dyn( &self, range: BytesRange, ) -> Pin<Box<dyn Future<Output = Result<(RpRead, Buffer), Error>> + Send + '_>>

The dyn version of Read::read.

Implementors§

Source§

impl<T> ReadDyn for T
where T: Read + ?Sized,