pub struct Example<T>(pub T);Expand description
A transparent wrapper that carries a typed value for OpenAPI example.
Serializes/deserializes identically to T (transparent serde).
When the utoipa feature is enabled, the value is exposed as a schema
example on the inner type. When the schemars feature is enabled, the
wrapper delegates to T’s schema.
§Examples
use api_bones::openapi::Example;
let ex = Example::new("hello");
assert_eq!(*ex, "hello");
assert_eq!(ex.into_inner(), "hello");Tuple Fields§
§0: TImplementations§
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Example<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Example<T>where
T: Deserialize<'de>,
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<T: Ord> Ord for Example<T>
impl<T: Ord> Ord for Example<T>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Example<T>
impl<T: PartialOrd> PartialOrd for Example<T>
impl<T: Eq> Eq for Example<T>
impl<T> StructuralPartialEq for Example<T>
Auto Trait Implementations§
impl<T> Freeze for Example<T>where
T: Freeze,
impl<T> RefUnwindSafe for Example<T>where
T: RefUnwindSafe,
impl<T> Send for Example<T>where
T: Send,
impl<T> Sync for Example<T>where
T: Sync,
impl<T> Unpin for Example<T>where
T: Unpin,
impl<T> UnsafeUnpin for Example<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Example<T>where
T: UnwindSafe,
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