pub struct Attachment {
pub filename: String,
pub content: Bytes,
pub content_type: Option<String>,
}Expand description
One file in a multipart upload.
The content is held in memory rather than streamed: a request that is retried — after a 401, or after a 503 — has to be sendable a second time, and a stream cannot be. Streaming uploads are a later addition, gated on the endpoints that genuinely need them.
Fields§
§filename: StringThe name the file is uploaded under.
content: BytesThe file’s bytes.
content_type: Option<String>The content type to declare. Guessed from the filename when absent.
Implementations§
Source§impl Attachment
impl Attachment
Sourcepub fn new(filename: impl Into<String>, content: impl Into<Bytes>) -> Self
pub fn new(filename: impl Into<String>, content: impl Into<Bytes>) -> Self
A file with this name and these bytes; the content type is guessed from the name.
Sourcepub fn with_content_type(self, content_type: impl Into<String>) -> Self
pub fn with_content_type(self, content_type: impl Into<String>) -> Self
Declares a content type instead of guessing one from the filename.
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Auto Trait Implementations§
impl !Freeze for Attachment
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnsafeUnpin for Attachment
impl UnwindSafe for Attachment
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