pub struct Writer<W: Write> { /* private fields */ }Expand description
Writes a MIME multipart body.
Port of Go’s multipart.NewWriter.
Implementations§
Source§impl<W: Write> Writer<W>
impl<W: Write> Writer<W>
pub fn new(inner: W) -> Self
pub fn boundary(&self) -> &str
Sourcepub fn form_data_content_type(&self) -> String
pub fn form_data_content_type(&self) -> String
The Content-Type value for the overall multipart body.
Sourcepub fn create_part(&mut self, header: Header) -> Result<PartWriter<'_, W>>
pub fn create_part(&mut self, header: Header) -> Result<PartWriter<'_, W>>
Create a new part with the given MIME headers.
Sourcepub fn create_form_field(
&mut self,
fieldname: &str,
) -> Result<PartWriter<'_, W>>
pub fn create_form_field( &mut self, fieldname: &str, ) -> Result<PartWriter<'_, W>>
Convenience: create a plain form field part.
Sourcepub fn create_form_file(
&mut self,
fieldname: &str,
filename: &str,
) -> Result<PartWriter<'_, W>>
pub fn create_form_file( &mut self, fieldname: &str, filename: &str, ) -> Result<PartWriter<'_, W>>
Convenience: create a file upload part.
Auto Trait Implementations§
impl<W> Freeze for Writer<W>where
W: Freeze,
impl<W> RefUnwindSafe for Writer<W>where
W: RefUnwindSafe,
impl<W> Send for Writer<W>where
W: Send,
impl<W> Sync for Writer<W>where
W: Sync,
impl<W> Unpin for Writer<W>where
W: Unpin,
impl<W> UnsafeUnpin for Writer<W>where
W: UnsafeUnpin,
impl<W> UnwindSafe for Writer<W>where
W: UnwindSafe,
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