pub struct Multipart<'a> { /* private fields */ }Expand description
Create a structure to process the multipart/form-data data format for the client to initiate the request.
§Examples
use sincere::http::plus::client::Multipart;
let mut multipart = Multipart::new();
multipart.add_text("hello", "world");
let (boundary, data) = multipart.convert().unwrap();Implementations§
Source§impl<'a> Multipart<'a>
impl<'a> Multipart<'a>
Sourcepub fn new() -> Multipart<'a>
pub fn new() -> Multipart<'a>
Returns the empty Multipart set.
§Examples
use sincere::http::plus::client;
let mut multipart = client::Multipart::new();Sourcepub fn add_text<V>(&mut self, name: V, value: V) -> &mut Self
pub fn add_text<V>(&mut self, name: V, value: V) -> &mut Self
Add text ‘key-value’ into Multipart.
§Examples
use sincere::http::plus::client;
let mut multipart = client::Multipart::new();
multipart.add_text("hello", "world");Sourcepub fn add_file<V, P>(&mut self, name: V, path: P) -> &mut Self
pub fn add_file<V, P>(&mut self, name: V, path: P) -> &mut Self
Add file into Multipart.
§Examples
use sincere::http::plus::client;
let mut multipart = client::Multipart::new();
multipart.add_file("hello.rs", "/aaa/bbb");Sourcepub fn add_stream<V, R>(
&mut self,
name: V,
stream: R,
filename: Option<V>,
mime: Option<Mime>,
) -> &mut Self
pub fn add_stream<V, R>( &mut self, name: V, stream: R, filename: Option<V>, mime: Option<Mime>, ) -> &mut Self
Add reader stream into Multipart.
§Examples
use sincere::http::plus::client;
let temp = r#"{"hello": "world"}"#.as_bytes();
let reader = ::std::io::Cursor::new(temp);
let mut multipart = client::Multipart::new();
multipart.add_stream("ddd", reader, Some("hello.rs"), Some(sincere::http::mime::APPLICATION_JSON));Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Multipart<'a>
impl<'a> !Send for Multipart<'a>
impl<'a> !Sync for Multipart<'a>
impl<'a> !UnwindSafe for Multipart<'a>
impl<'a> Freeze for Multipart<'a>
impl<'a> Unpin for Multipart<'a>
impl<'a> UnsafeUnpin for Multipart<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more