pub struct PutObject { /* private fields */ }Expand description
Upload a file
The object size cannot exceed 5GB
By default, if an object with the same name exists and you have access, the new object overwrites it
See the Alibaba Cloud documentation for details
Implementations§
Source§impl PutObject
impl PutObject
Sourcepub fn set_mime(self, mime: impl ToString) -> Self
pub fn set_mime(self, mime: impl ToString) -> Self
Set the file’s MIME type
If no MIME type is set, the request will attempt to obtain it from the content, local path, or remote path; if still not found, the default MIME type (application/octet-stream) is used
Sourcepub fn set_storage_class(self, storage_class: StorageClass) -> Self
pub fn set_storage_class(self, storage_class: StorageClass) -> Self
Set the file’s storage class
Sourcepub fn set_cache_control(self, cache_control: CacheControl) -> Self
pub fn set_cache_control(self, cache_control: CacheControl) -> Self
Cache behavior of the webpage when the file is downloaded
Sourcepub fn set_content_disposition(
self,
content_disposition: ContentDisposition,
) -> Self
pub fn set_content_disposition( self, content_disposition: ContentDisposition, ) -> Self
Set how the file is presented
Sourcepub fn forbid_overwrite(self) -> Self
pub fn forbid_overwrite(self) -> Self
Disallow overwriting files with the same name
Sourcepub fn set_meta(self, key: impl ToString, value: impl ToString) -> Self
pub fn set_meta(self, key: impl ToString, value: impl ToString) -> Self
Set additional metadata
Keys may only contain letters, numbers, and hyphens; metadata with other characters will be discarded
Sourcepub fn set_tagging(self, key: impl ToString, value: impl ToString) -> Self
pub fn set_tagging(self, key: impl ToString, value: impl ToString) -> Self
Set tag information
Sourcepub fn set_callback(
self,
callback: Box<dyn Fn(u64, u64) + Send + Sync + 'static>,
) -> Self
pub fn set_callback( self, callback: Box<dyn Fn(u64, u64) + Send + Sync + 'static>, ) -> Self
Set a callback for upload progress; this only applies to send_file()
let callback = Box::new(|uploaded_size: u64, total_size: u64| {
let percentage = if total_size == 0 {
100.0
} else {
(uploaded_size as f64) / (total_size as f64) * 100.00
};
println!("{:.2}%", percentage);
});