pub struct UploadOptions {
pub content_type: Option<String>,
pub metadata: HashMap<String, String>,
pub progress: Option<ProgressCallback>,
}Expand description
Options describing how a file is stored during an upload.
Groups the content type, user metadata, and optional progress callback so a
single upload(source, key, options) call replaces a run of positional
arguments. Build with UploadOptions::new and the with_* methods, or
construct the struct directly.
Fields§
§content_type: Option<String>MIME content type; falls back to the store default when absent.
metadata: HashMap<String, String>User metadata stored alongside the file.
progress: Option<ProgressCallback>Progress callback invoked as bytes are written, for backends that report progress.
Implementations§
Source§impl UploadOptions
impl UploadOptions
Sourcepub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
Set the MIME content type for the uploaded file.
Sourcepub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
Attach user metadata stored alongside the file.
Sourcepub fn with_progress(self, progress: ProgressCallback) -> Self
pub fn with_progress(self, progress: ProgressCallback) -> Self
Attach a progress callback invoked as bytes are written.
Sourcepub fn content_type(&self) -> Option<&str>
pub fn content_type(&self) -> Option<&str>
Borrow the content type as a string slice, when set.
Trait Implementations§
Source§impl Clone for UploadOptions
impl Clone for UploadOptions
Source§fn clone(&self) -> UploadOptions
fn clone(&self) -> UploadOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for UploadOptions
impl Default for UploadOptions
Source§fn default() -> UploadOptions
fn default() -> UploadOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for UploadOptions
impl !UnwindSafe for UploadOptions
impl Freeze for UploadOptions
impl Send for UploadOptions
impl Sync for UploadOptions
impl Unpin for UploadOptions
impl UnsafeUnpin for UploadOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more