pub enum UploadSource {
Bytes {
data: Bytes,
filename: String,
mime_type: Option<String>,
},
Path {
path: PathBuf,
data: Bytes,
filename: String,
mime_type: Option<String>,
},
Reader {
data: Bytes,
filename: String,
mime_type: Option<String>,
},
}Expand description
表示一个可上传的文件来源。
Variants§
Implementations§
Source§impl UploadSource
impl UploadSource
Sourcepub fn from_bytes<T, U>(bytes: T, filename: U) -> Self
pub fn from_bytes<T, U>(bytes: T, filename: U) -> Self
从内存字节创建上传源。
Sourcepub fn from_reader<R, U>(reader: R, filename: U) -> Result<Self>
pub fn from_reader<R, U>(reader: R, filename: U) -> Result<Self>
Sourcepub async fn from_response(response: Response) -> Result<Self>
pub async fn from_response(response: Response) -> Result<Self>
Sourcepub fn with_mime_type<T>(self, mime_type: T) -> Self
pub fn with_mime_type<T>(self, mime_type: T) -> Self
覆盖 MIME 类型。
Sourcepub fn with_filename<T>(self, filename: T) -> Self
pub fn with_filename<T>(self, filename: T) -> Self
覆盖文件名。
Trait Implementations§
Source§impl Clone for UploadSource
impl Clone for UploadSource
Source§fn clone(&self) -> UploadSource
fn clone(&self) -> UploadSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UploadSource
impl Debug for UploadSource
Source§impl From<UploadSource> for AudioPlaybackInput
impl From<UploadSource> for AudioPlaybackInput
Source§fn from(value: UploadSource) -> Self
fn from(value: UploadSource) -> Self
Converts to this type from the input type.
Source§impl From<UploadSource> for ToFileInput
impl From<UploadSource> for ToFileInput
Source§fn from(value: UploadSource) -> Self
fn from(value: UploadSource) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for UploadSource
impl RefUnwindSafe for UploadSource
impl Send for UploadSource
impl Sync for UploadSource
impl Unpin for UploadSource
impl UnsafeUnpin for UploadSource
impl UnwindSafe for UploadSource
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