Trait qiniu_sdk::prelude::DataSource
source · [−]pub trait DataSource<A>: Debug + Sync + Send where
A: Digest, {
fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>;
fn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>;
fn total_size(&self) -> Result<Option<u64>, Error>;
fn source_key(&self) -> Result<Option<SourceKey<A>>, Error> { ... }
fn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>> { ... }
fn async_total_size(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<u64>, Error>> + Send, Global>> { ... }
}
Expand description
数据源接口
提供上传所用的数据源
Required Methods
Provided Methods
异步获取数据源 KEY
用于区分不同的数据源
Implementations on Foreign Types
sourceimpl<A, T> DataSource<A> for Arc<T> where
A: Digest,
T: DataSource<A> + ?Sized,
Arc<T>: Debug,
Arc<T>: Sync,
Arc<T>: Send,
impl<A, T> DataSource<A> for Arc<T> where
A: Digest,
T: DataSource<A> + ?Sized,
Arc<T>: Debug,
Arc<T>: Sync,
Arc<T>: Send,
sourcefn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
数据源切片
该方法的异步版本为 Self::async_slice
。
sourcefn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
fn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
异步数据源切片
sourcefn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>
fn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>
异步获取数据源 KEY
用于区分不同的数据源
sourcefn total_size(&self) -> Result<Option<u64>, Error>
fn total_size(&self) -> Result<Option<u64>, Error>
获取数据源大小
该方法的异步版本为 Self::async_total_size
。
sourceimpl<'a, A, T> DataSource<A> for &'a T where
A: Digest,
T: 'a + DataSource<A> + ?Sized,
&'a T: Debug,
&'a T: Sync,
&'a T: Send,
impl<'a, A, T> DataSource<A> for &'a T where
A: Digest,
T: 'a + DataSource<A> + ?Sized,
&'a T: Debug,
&'a T: Sync,
&'a T: Send,
sourcefn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
数据源切片
该方法的异步版本为 [Self::async_slice
]。
sourcefn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
fn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
异步数据源切片
sourcefn source_key(&self) -> Result<Option<SourceKey<A>>, Error>
fn source_key(&self) -> Result<Option<SourceKey<A>>, Error>
获取数据源 KEY
用于区分不同的数据源
该方法的异步版本为 [Self::async_source_key
]。
sourceimpl<'a, A, T> DataSource<A> for &'a mut T where
A: Digest,
T: 'a + DataSource<A> + ?Sized,
&'a mut T: Debug,
&'a mut T: Sync,
&'a mut T: Send,
impl<'a, A, T> DataSource<A> for &'a mut T where
A: Digest,
T: 'a + DataSource<A> + ?Sized,
&'a mut T: Debug,
&'a mut T: Sync,
&'a mut T: Send,
sourcefn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
数据源切片
该方法的异步版本为 [Self::async_slice
]。
sourcefn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
fn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
异步数据源切片
sourcefn source_key(&self) -> Result<Option<SourceKey<A>>, Error>
fn source_key(&self) -> Result<Option<SourceKey<A>>, Error>
获取数据源 KEY
用于区分不同的数据源
该方法的异步版本为 [Self::async_source_key
]。
sourceimpl<A, T> DataSource<A> for Rc<T> where
A: Digest,
T: DataSource<A> + ?Sized,
Rc<T>: Debug,
Rc<T>: Sync,
Rc<T>: Send,
impl<A, T> DataSource<A> for Rc<T> where
A: Digest,
T: DataSource<A> + ?Sized,
Rc<T>: Debug,
Rc<T>: Sync,
Rc<T>: Send,
sourcefn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
数据源切片
该方法的异步版本为 Self::async_slice
。
sourcefn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
fn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
异步数据源切片
sourcefn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>
fn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>
异步获取数据源 KEY
用于区分不同的数据源
sourcefn total_size(&self) -> Result<Option<u64>, Error>
fn total_size(&self) -> Result<Option<u64>, Error>
获取数据源大小
该方法的异步版本为 Self::async_total_size
。
sourceimpl<A, T> DataSource<A> for Box<T, Global> where
A: Digest,
T: DataSource<A> + ?Sized,
Box<T, Global>: Debug,
Box<T, Global>: Sync,
Box<T, Global>: Send,
impl<A, T> DataSource<A> for Box<T, Global> where
A: Digest,
T: DataSource<A> + ?Sized,
Box<T, Global>: Debug,
Box<T, Global>: Sync,
Box<T, Global>: Send,
sourcefn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
fn slice(&self, size: PartSize) -> Result<Option<DataSourceReader>, Error>
数据源切片
该方法的异步版本为 Self::async_slice
。
sourcefn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
fn async_slice(
&self,
size: PartSize
) -> Pin<Box<dyn Future<Output = Result<Option<AsyncDataSourceReader>, Error>> + Send, Global>>
异步数据源切片
sourcefn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>
fn async_source_key(
&self
) -> Pin<Box<dyn Future<Output = Result<Option<SourceKey<A>>, Error>> + Send, Global>>
异步获取数据源 KEY
用于区分不同的数据源
sourcefn total_size(&self) -> Result<Option<u64>, Error>
fn total_size(&self) -> Result<Option<u64>, Error>
获取数据源大小
该方法的异步版本为 Self::async_total_size
。