#[non_exhaustive]pub struct RequestBody {
pub description: Option<String>,
pub contents: IndexMap<String, Content>,
pub required: Option<Required>,
}
Expand description
Implements OpenAPI Request Body.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.description: Option<String>
Additional description of RequestBody
supporting markdown syntax.
contents: IndexMap<String, Content>
Map of request body contents mapped by content type e.g. application/json
.
required: Option<Required>
Determines whether request body is required in the request or not.
Implementations§
Source§impl RequestBody
impl RequestBody
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct a new empty RequestBody
. This is effectively same as calling RequestBody::default
.
Sourcepub fn description<S: Into<String>>(self, description: S) -> Self
pub fn description<S: Into<String>>(self, description: S) -> Self
Add description for RequestBody
.
Sourcepub fn required(self, required: Required) -> Self
pub fn required(self, required: Required) -> Self
Define RequestBody
required.
Sourcepub fn add_content<S: Into<String>, C: Into<Content>>(
self,
kind: S,
content: C,
) -> Self
pub fn add_content<S: Into<String>, C: Into<Content>>( self, kind: S, content: C, ) -> Self
Add Content
by content type e.g application/json
to RequestBody
.
Sourcepub fn merge(&mut self, other: Self)
pub fn merge(&mut self, other: Self)
Fill RequestBody
with values from another RequestBody
.
Trait Implementations§
Source§impl Clone for RequestBody
impl Clone for RequestBody
Source§fn clone(&self) -> RequestBody
fn clone(&self) -> RequestBody
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RequestBody
impl Debug for RequestBody
Source§impl Default for RequestBody
impl Default for RequestBody
Source§fn default() -> RequestBody
fn default() -> RequestBody
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for RequestBody
impl<'de> Deserialize<'de> for RequestBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for RequestBody
impl PartialEq for RequestBody
Source§impl Serialize for RequestBody
impl Serialize for RequestBody
impl StructuralPartialEq 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