pub trait AsyncDataSource<A>: DynClone + Debug + Sync + Sendwhere
    A: Digest,{
    // Required methods
    fn slice(
        &self,
        size: PartSize
    ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>;
    fn reset(
        &self
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>;
    fn source_key(
        &self
    ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>;
    fn total_size(
        &self
    ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>;
}
Expand description

异步数据源接口

提供上传所用的数据源

Required Methods§

source

fn slice( &self, size: PartSize ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>

异步数据源切片

source

fn reset( &self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>

异步重置数据源

source

fn source_key( &self ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>

异步获取数据源 KEY

用于区分不同的数据源

source

fn total_size( &self ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>

异步获取数据源大小

Implementations on Foreign Types§

source§

impl<A, T> AsyncDataSource<A> for Rc<T>where A: Digest, T: AsyncDataSource<A> + ?Sized, Rc<T>: DynClone + Debug + Sync + Send,

source§

fn slice( &self, size: PartSize ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>

source§

fn reset( &self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>

source§

fn source_key( &self ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>

source§

fn total_size( &self ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>

source§

impl<'a, A, T> AsyncDataSource<A> for &'a mut Twhere A: Digest, T: 'a + AsyncDataSource<A> + ?Sized, &'a mut T: DynClone + Debug + Sync + Send,

source§

fn slice( &self, size: PartSize ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>

source§

fn reset( &self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>

source§

fn source_key( &self ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>

source§

fn total_size( &self ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>

source§

impl<A, T> AsyncDataSource<A> for Box<T, Global>where A: Digest, T: AsyncDataSource<A> + ?Sized, Box<T, Global>: DynClone + Debug + Sync + Send,

source§

fn slice( &self, size: PartSize ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>

source§

fn reset( &self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>

source§

fn source_key( &self ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>

source§

fn total_size( &self ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>

source§

impl<A, T> AsyncDataSource<A> for Arc<T>where A: Digest, T: AsyncDataSource<A> + ?Sized, Arc<T>: DynClone + Debug + Sync + Send,

source§

fn slice( &self, size: PartSize ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>

source§

fn reset( &self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>

source§

fn source_key( &self ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>

source§

fn total_size( &self ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>

source§

impl<'a, A, T> AsyncDataSource<A> for &'a Twhere A: Digest, T: 'a + AsyncDataSource<A> + ?Sized, &'a T: DynClone + Debug + Sync + Send,

source§

fn slice( &self, size: PartSize ) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>

source§

fn reset( &self ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send, Global>>

source§

fn source_key( &self ) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>

source§

fn total_size( &self ) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>>

Implementors§

source§

impl<A> AsyncDataSource<A> for AsyncFileDataSource<A>where A: Digest + Send,

source§

impl<R, A> AsyncDataSource<A> for AsyncUnseekableDataSource<R, A>where R: AsyncRead + Debug + Unpin + Send + Sync + 'static, A: Digest,