Enum RequestBody

Source
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

Fields

§file: File
§buffer_size: usize
§

AsyncRead(Pin<Box<dyn AsyncRead + Send + Sync>>)

§

TcpStream(TcpStream)

§

ProcessOutput

Fields

§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

Fields

§reader: Pin<Box<dyn AsyncRead + Send + Sync>>
§codec_type: CodecType

Implementations§

Source§

impl RequestBody

Source

pub const fn from_static(s: &'static str) -> Self

Source

pub fn from_string(s: impl Into<String>) -> Self

Source

pub fn from_bytes(bytes: Bytes) -> Self

Source

pub fn from_vec(vec: Vec<u8>) -> Self

Source

pub fn from_json(value: Value) -> Self

Source

pub fn from_json_serializable<T: Serialize>(value: &T) -> Result<Self, Error>

Source

pub fn from_form(form: Vec<(String, String)>) -> Self

Source

pub fn from_form_pairs<I, K, V>(pairs: I) -> Self
where I: IntoIterator<Item = (K, V)>, K: Into<String>, V: Into<String>,

Source

pub fn from_multipart(form: Form) -> Self

Source

pub const fn empty() -> Self

Source

pub fn from_reqwest_body(body: Body) -> Self

Source

pub fn from_file(file: File) -> Self

Source

pub fn from_file_buffered(file: File, buffer_size: usize) -> Self

Source

pub fn from_async_read<R>(reader: R) -> Self
where R: AsyncRead + Send + Sync + 'static,

Source

pub async fn from_file_path<P: AsRef<Path>>( path: P, ) -> Result<Self, StreamError>

Source

pub async fn from_file_path_buffered<P: AsRef<Path>>( path: P, buffer_size: usize, ) -> Result<Self, StreamError>

Source

pub fn from_tcp_stream(tcp: TcpStream) -> Self

Source

pub fn from_command_output(command: Command) -> Result<Self, StreamError>

Source

pub fn from_stream<S>(stream: S) -> Self
where S: Stream<Item = Result<Bytes, StreamError>> + Send + Sync + 'static,

Source

pub fn from_io_stream<S>(stream: S) -> Self
where S: Stream<Item = Result<Bytes, Error>> + Send + Sync + 'static,

Source

pub fn from_bytes_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = Bytes>,

Source

pub fn from_framed_read<R>(reader: R, codec_type: CodecType) -> Self
where R: AsyncRead + Send + Sync + 'static,

Source

pub fn from_bytes_framed<R>(reader: R) -> Self
where R: AsyncRead + Send + Sync + 'static,

Source

pub fn is_empty(&self) -> bool

Source

pub fn content_length(&self) -> Option<u64>

Source

pub fn into_reqwest_body(self, client: RequestBuilder) -> RequestBuilder

Trait Implementations§

Source§

impl Debug for RequestBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RequestBody

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToStringFallible for T
where T: Display,

Source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,