pub enum RequestBody {
Show 18 variants
Static(&'static str),
String(String),
Bytes(Bytes),
Vec(Vec<u8>),
Form(Vec<(String, String)>),
Multipart(Form),
Json(Value),
Custom(Body),
Empty,
File(File),
BufferedFile {
file: File,
buffer_size: usize,
},
AsyncRead(Pin<Box<dyn AsyncRead + Send + Sync>>),
TcpStream(TcpStream),
ProcessOutput {
command: String,
child: Child,
stdout: Pin<Box<dyn AsyncRead + Send + Sync>>,
},
Stream(Pin<Box<dyn Stream<Item = Result<Bytes, StreamError>> + Send + Sync>>),
IoStream(Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send + Sync>>),
BytesIterator(Vec<Bytes>),
CodecReader {
reader: Pin<Box<dyn AsyncRead + Send + Sync>>,
codec_type: CodecType,
},
}Variants§
Static(&'static str)
String(String)
Bytes(Bytes)
Vec(Vec<u8>)
Form(Vec<(String, String)>)
Multipart(Form)
Json(Value)
Custom(Body)
Empty
File(File)
BufferedFile
AsyncRead(Pin<Box<dyn AsyncRead + Send + Sync>>)
TcpStream(TcpStream)
ProcessOutput
Stream(Pin<Box<dyn Stream<Item = Result<Bytes, StreamError>> + Send + Sync>>)
IoStream(Pin<Box<dyn Stream<Item = Result<Bytes, Error>> + Send + Sync>>)
BytesIterator(Vec<Bytes>)
CodecReader
Implementations§
Source§impl RequestBody
impl RequestBody
pub const fn from_static(s: &'static str) -> Self
pub fn from_string(s: impl Into<String>) -> Self
pub fn from_bytes(bytes: Bytes) -> Self
pub fn from_vec(vec: Vec<u8>) -> Self
pub fn from_json(value: Value) -> Self
pub fn from_json_serializable<T: Serialize>(value: &T) -> Result<Self, Error>
pub fn from_form(form: Vec<(String, String)>) -> Self
pub fn from_form_pairs<I, K, V>(pairs: I) -> Self
pub fn from_multipart(form: Form) -> Self
pub const fn empty() -> Self
pub fn from_reqwest_body(body: Body) -> Self
pub fn from_file(file: File) -> Self
pub fn from_file_buffered(file: File, buffer_size: usize) -> Self
pub fn from_async_read<R>(reader: R) -> Self
pub async fn from_file_path<P: AsRef<Path>>( path: P, ) -> Result<Self, StreamError>
pub async fn from_file_path_buffered<P: AsRef<Path>>( path: P, buffer_size: usize, ) -> Result<Self, StreamError>
pub fn from_tcp_stream(tcp: TcpStream) -> Self
pub fn from_command_output(command: Command) -> Result<Self, StreamError>
pub fn from_stream<S>(stream: S) -> Self
pub fn from_io_stream<S>(stream: S) -> Self
pub fn from_bytes_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Bytes>,
pub fn from_framed_read<R>(reader: R, codec_type: CodecType) -> Self
pub fn from_bytes_framed<R>(reader: R) -> Self
pub fn is_empty(&self) -> bool
pub fn content_length(&self) -> Option<u64>
pub fn into_reqwest_body(self, client: RequestBuilder) -> RequestBuilder
Trait Implementations§
Source§impl Debug for RequestBody
impl Debug for RequestBody
Auto Trait Implementations§
impl !Freeze for RequestBody
impl !RefUnwindSafe for RequestBody
impl Send for RequestBody
impl Sync for RequestBody
impl Unpin for RequestBody
impl !UnwindSafe for RequestBody
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.