#[non_exhaustive]pub struct Example {
pub summary: String,
pub description: String,
pub value: Option<Value>,
pub external_value: String,
}
Expand description
Implements OpenAPI Example Object.
Example is used on path operations to describe possible response bodies.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.summary: String
Short description for the Example
.
description: String
Long description for the Example
. Value supports markdown syntax for rich text
representation.
value: Option<Value>
Embedded literal example value. Example::value
and Example::external_value
are
mutually exclusive.
external_value: String
An URI that points to a literal example value. Example::external_value
provides the
capability to references an example that cannot be easily included in JSON or YAML.
Example::value
and Example::external_value
are mutually exclusive.
Implementations§
Source§impl Example
impl Example
Sourcepub fn new() -> Example
pub fn new() -> Example
Construct a new empty Example
. This is effectively same as calling Example::default
.
Sourcepub fn summary<S>(self, summary: S) -> Example
pub fn summary<S>(self, summary: S) -> Example
Add or change a short description for the Example
. Setting this to empty String
will make it not render in the generated OpenAPI document.
Sourcepub fn description<D>(self, description: D) -> Example
pub fn description<D>(self, description: D) -> Example
Add or change a long description for the Example
. Markdown syntax is supported for rich
text representation.
Setting this to empty String
will make it not render in the generated
OpenAPI document.
Sourcepub fn value(self, value: Value) -> Example
pub fn value(self, value: Value) -> Example
Add or change embedded literal example value. Example::value
and Example::external_value
are mutually exclusive.
Sourcepub fn external_value<E>(self, external_value: E) -> Example
pub fn external_value<E>(self, external_value: E) -> Example
Add or change an URI that points to a literal example value. Example::external_value
provides the capability to references an example that cannot be easily included
in JSON or YAML. Example::value
and Example::external_value
are mutually exclusive.
Setting this to an empty String will make the field not to render in the generated OpenAPI document.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Example
impl<'de> Deserialize<'de> for Example
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Example, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Example, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Example
impl Serialize for Example
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Example
impl StructuralPartialEq for Example
Auto Trait Implementations§
impl Freeze for Example
impl RefUnwindSafe for Example
impl Send for Example
impl Sync for Example
impl Unpin for Example
impl UnwindSafe for Example
Blanket Implementations§
Source§impl<Data> ApiSuccessResponse for Data
impl<Data> ApiSuccessResponse for Data
fn api_response<Meta>(self, meta: Option<Meta>) -> ApiResponse<Self, Meta>
fn api_response_without_meta<Meta>(self) -> ApiResponse<Self, Meta>
fn api_response_with_meta<Meta>(self, meta: Meta) -> ApiResponse<Self, Meta>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> FutureTraceExt for Twhere
T: FutureExt,
impl<T> FutureTraceExt for Twhere
T: FutureExt,
Source§fn with_current_context_span(self, otel_span: Span) -> WithContext<Self> ⓘ
fn with_current_context_span(self, otel_span: Span) -> WithContext<Self> ⓘ
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> 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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request