pub trait ParallelUploader:
Uploader
+ Send
+ Sync {
// Required method
fn upload_asset(
&self,
asset: AssetInfo,
) -> JoinHandle<Result<(String, String)>>;
// Provided method
fn parallel_limit(&self) -> usize { ... }
}Expand description
Types that can upload assets in parallel.
This trait abstracts the threading logic and allows methods to focus on the logic of uploading a single asset (file).
Required Methods§
Sourcefn upload_asset(&self, asset: AssetInfo) -> JoinHandle<Result<(String, String)>>
fn upload_asset(&self, asset: AssetInfo) -> JoinHandle<Result<(String, String)>>
Returns a JoinHandle to the task responsible to upload the specified asset.
§Arguments
asset- Theassetto upload
§Example
In most cases, the function will return the value from tokio::spawn:
ⓘ
tokio::spawn(async move {
// code responsible to upload a single asset
});Provided Methods§
Sourcefn parallel_limit(&self) -> usize
fn parallel_limit(&self) -> usize
Return the number of concurrent uploads allowed. The default implementation returns the value PARALLEL_LIMIT.