pub struct Part { /* private fields */ }Available on crate features
client and multipart only.Expand description
A single field of a Form.
A Part can be created from in-memory bytes/text (Part::text, Part::bytes), an
arbitrary async reader (Part::reader, the counterpart of SetFileReader), or a file path
(Part::file). Additional metadata such as filename and Content-Type can be attached
with Part::file_name and Part::mime_str/Part::mime.
Implementations§
Source§impl Part
impl Part
Sourcepub async fn file<P>(path: P) -> Result<Self>
pub async fn file<P>(path: P) -> Result<Self>
Create a Part from a file path, whose content is streamed lazily.
The filename defaults to the file name of the path, and the Content-Type is guessed
from the file extension. Both can be overridden by Part::file_name and
Part::mime_str/Part::mime.
Auto Trait Implementations§
impl !Freeze for Part
impl !RefUnwindSafe for Part
impl !UnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnsafeUnpin for Part
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