pub trait DataSource<A: Digest>: DynClone + Debug + Sync + Send {
    // Required methods
    fn slice(&self, size: PartSize) -> IoResult<Option<DataSourceReader>>;
    fn reset(&self) -> IoResult<()>;
    fn total_size(&self) -> IoResult<Option<u64>>;

    // Provided method
    fn source_key(&self) -> IoResult<Option<SourceKey<A>>> { ... }
}
Expand description

数据源接口

提供上传所用的数据源

该 Trait 的异步版本为 AsyncDataSource

Required Methods§

source

fn slice(&self, size: PartSize) -> IoResult<Option<DataSourceReader>>

数据源切片

source

fn reset(&self) -> IoResult<()>

重置数据源

source

fn total_size(&self) -> IoResult<Option<u64>>

获取数据源大小

Provided Methods§

source

fn source_key(&self) -> IoResult<Option<SourceKey<A>>>

获取数据源 KEY

用于区分不同的数据源

Trait Implementations§

source§

impl<'clone, A: Digest> Clone for Box<dyn DataSource<A> + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'clone, A: Digest> Clone for Box<dyn DataSource<A> + Send + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'clone, A: Digest> Clone for Box<dyn DataSource<A> + Send + Sync + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'clone, A: Digest> Clone for Box<dyn DataSource<A> + Sync + 'clone>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementations on Foreign Types§

source§

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

source§

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

source§

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

source§

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

source§

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

Implementors§

source§

impl<D: Digest + Send> DataSource<D> for FileDataSource<D>

source§

impl<R: Read + Debug + Send + Sync + 'static, A: Digest> DataSource<A> for UnseekableDataSource<R, A>