pub struct Multipart { /* private fields */ }
Expand description
Represents a multipart HTTP message body, parsed according to the syntax of RFC 2046.
Of particular interest to HTTP are multipart/byte-ranges
and
multipart/form-data
,
Although the headers of a #SoupMultipart body part will contain the full headers from that body part, libsoup does not interpret them according to MIME rules. For example, each body part is assumed to have “binary” Content-Transfer-Encoding, even if its headers explicitly state otherwise. In other words, don’t try to use #SoupMultipart for handling real MIME multiparts.
Implementations§
source§impl Multipart
impl Multipart
sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const SoupMultipart
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const SoupMultipart ) -> &'a Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut<'a>(
ptr: *mut *mut SoupMultipart
) -> &'a mut Self
pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut *mut SoupMultipart ) -> &'a mut Self
Borrows the underlying C value mutably.
source§impl Multipart
impl Multipart
sourcepub fn new(mime_type: &str) -> Multipart
pub fn new(mime_type: &str) -> Multipart
Creates a new empty #SoupMultipart with a randomly-generated boundary string.
Note that @mime_type must be the full MIME type, including “multipart/”.
See also: Message::from_multipart()
.
§mime_type
the MIME type of the multipart to create.
§Returns
a new empty #SoupMultipart of the given @mime_type
sourcepub fn from_message(headers: &MessageHeaders, body: &Bytes) -> Option<Multipart>
pub fn from_message(headers: &MessageHeaders, body: &Bytes) -> Option<Multipart>
sourcepub fn append_form_file(
&mut self,
control_name: &str,
filename: Option<&str>,
content_type: Option<&str>,
body: &Bytes
)
pub fn append_form_file( &mut self, control_name: &str, filename: Option<&str>, content_type: Option<&str>, body: &Bytes )
Adds a new MIME part containing @body to @self
Uses “Content-Disposition: form-data”, as per the HTML forms specification.
§control_name
the name of the control associated with this file
§filename
the name of the file, or None
if not known
§content_type
the MIME type of the file, or None
if not known
§body
the file data
sourcepub fn append_form_string(&mut self, control_name: &str, data: &str)
pub fn append_form_string(&mut self, control_name: &str, data: &str)
sourcepub fn append_part(&mut self, headers: &MessageHeaders, body: &Bytes)
pub fn append_part(&mut self, headers: &MessageHeaders, body: &Bytes)
sourcepub fn to_message(&mut self, dest_headers: &MessageHeaders) -> Bytes
pub fn to_message(&mut self, dest_headers: &MessageHeaders) -> Bytes
Trait Implementations§
source§impl HasParamSpec for Multipart
impl HasParamSpec for Multipart
source§impl Ord for Multipart
impl Ord for Multipart
source§impl PartialEq for Multipart
impl PartialEq for Multipart
source§impl PartialOrd for Multipart
impl PartialOrd for Multipart
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for Multipart
impl StaticType for Multipart
source§fn static_type() -> Type
fn static_type() -> Type
Self
.