RequestContent

Struct RequestContent 

Source
pub struct RequestContent<T, F = JsonFormat> { /* private fields */ }
Expand description

The body content of a service client request.

This allows callers to pass a model to serialize or raw content to client methods.

Implementations§

Source§

impl<T, F> RequestContent<T, F>

Source

pub fn body(&self) -> &Body

Gets the body of the request.

Source

pub fn from(body: Vec<u8>) -> RequestContent<T, F>

Create a new RequestContent from a Vec<u8>.

Allocation may be avoided in some cases.

Source

pub fn from_slice(body: &[u8]) -> RequestContent<T, F>

Copies bytes into a new RequestContent.

Source

pub fn from_static(body: &'static [u8]) -> RequestContent<T, F>

Create a new RequestContent from a static slice.

This should not allocate.

Source

pub fn from_str(body: &str) -> RequestContent<T, F>

Copies UTF-8 bytes into a new RequestContent.

Trait Implementations§

Source§

impl<T, F> Clone for RequestContent<T, F>
where T: Clone, F: Clone,

Source§

fn clone(&self) -> RequestContent<T, F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, F> Debug for RequestContent<T, F>
where T: Debug, F: Debug,

Source§

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

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

impl<T, F> From<Body> for RequestContent<T, F>

Source§

fn from(body: Body) -> RequestContent<T, F>

Converts to this type from the input type.
Source§

impl<T, F> From<Bytes> for RequestContent<T, F>

Source§

fn from(body: Bytes) -> RequestContent<T, F>

Converts to this type from the input type.
Source§

impl<T, F> From<RequestContent<T, F>> for Body

Source§

fn from(content: RequestContent<T, F>) -> Body

Converts to this type from the input type.
Source§

impl<T> TryFrom<&str> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: &str) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T, F> TryFrom<Decimal> for RequestContent<T, F>

Source§

type Error = Infallible

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

fn try_from(value: Decimal) -> Result<RequestContent<T, F>, Infallible>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, &str>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, &str>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T, F> TryFrom<HashMap<String, OffsetDateTime>> for RequestContent<T, F>

Source§

type Error = Error

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

fn try_from( body: HashMap<String, OffsetDateTime>, ) -> Result<RequestContent<T, F>, <RequestContent<T, F> as TryFrom<HashMap<String, OffsetDateTime>>>::Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, String>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, String>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, Value>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, Value>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, bool>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, bool>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, f32>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, f32>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, f64>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, f64>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, i32>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, i32>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<HashMap<String, i64>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: HashMap<String, i64>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T, F> TryFrom<Option<Decimal>> for RequestContent<T, F>

Source§

type Error = Infallible

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

fn try_from(value: Option<Decimal>) -> Result<RequestContent<T, F>, Infallible>

Performs the conversion.
Source§

impl<T> TryFrom<String> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: String) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Value> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Value) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<&str>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<&str>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T, F> TryFrom<Vec<OffsetDateTime>> for RequestContent<T, F>

Source§

type Error = Error

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

fn try_from( body: Vec<OffsetDateTime>, ) -> Result<RequestContent<T, F>, <RequestContent<T, F> as TryFrom<Vec<OffsetDateTime>>>::Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<String>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<String>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<Value>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<Value>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<bool>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<bool>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<f32>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<f32>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<f64>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<f64>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<i32>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<i32>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<Vec<i64>> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: Vec<i64>) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<bool> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: bool) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<f32> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: f32) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<f64> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: f64) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<i32> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: i32) -> Result<RequestContent<T>, Error>

Performs the conversion.
Source§

impl<T> TryFrom<i64> for RequestContent<T>

Source§

type Error = Error

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

fn try_from(value: i64) -> Result<RequestContent<T>, Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<T, F = JsonFormat> !Freeze for RequestContent<T, F>

§

impl<T, F = JsonFormat> !RefUnwindSafe for RequestContent<T, F>

§

impl<T, F> Send for RequestContent<T, F>
where T: Send, F: Send,

§

impl<T, F> Sync for RequestContent<T, F>
where T: Sync, F: Sync,

§

impl<T, F> Unpin for RequestContent<T, F>
where T: Unpin, F: Unpin,

§

impl<T, F = JsonFormat> !UnwindSafe for RequestContent<T, F>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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,