Trait DataSource

Source
pub trait DataSource<A>:
    DynClone
    + Debug
    + Sync
    + Send
where A: Digest,
{ // Required methods fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>; fn reset(&self) -> Result<(), Error>; fn total_size(&self) -> Result<Option<u64>, Error>; // Provided method fn source_key(&self) -> Result<Option<SourceKey<A>>, Error> { ... } }
Expand description

数据源接口

提供上传所用的数据源

该 Trait 的异步版本为 AsyncDataSource

Required Methods§

Source

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

数据源切片

Source

fn reset(&self) -> Result<(), Error>

重置数据源

Source

fn total_size(&self) -> Result<Option<u64>, Error>

获取数据源大小

Provided Methods§

Source

fn source_key(&self) -> Result<Option<SourceKey<A>>, Error>

获取数据源 KEY

用于区分不同的数据源

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> Box<dyn DataSource<A> + 'clone>

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> Clone for Box<dyn DataSource<A> + Send + 'clone>
where A: Digest,

Source§

fn clone(&self) -> Box<dyn DataSource<A> + Send + 'clone>

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> Clone for Box<dyn DataSource<A> + Sync + Send + 'clone>
where A: Digest,

Source§

fn clone(&self) -> Box<dyn DataSource<A> + Sync + Send + 'clone>

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> Clone for Box<dyn DataSource<A> + Sync + 'clone>
where A: Digest,

Source§

fn clone(&self) -> Box<dyn DataSource<A> + Sync + 'clone>

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, A, T> DataSource<A> for &'a T
where A: Digest, T: 'a + DataSource<A> + ?Sized, &'a T: DynClone + Debug + Sync + Send,

Source§

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

Source§

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

Source§

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

Source§

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

Implementors§

Source§

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

Source§

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