Struct utoipa::openapi::schema::Discriminator
source · pub struct Discriminator {
pub property_name: String,
}
Expand description
OpenAPI Discriminator object which can be optionally used together with
OneOf
composite object.
Fields§
§property_name: String
Defines a discriminator property name which must be found within all composite objects.
Implementations§
source§impl Discriminator
impl Discriminator
sourcepub fn new<I: Into<String>>(property_name: I) -> Self
pub fn new<I: Into<String>>(property_name: I) -> Self
Construct a new Discriminator
object with property name.
Examples
Create a new Discriminator
object for pet_type
property.
let discriminator = Discriminator::new("pet_type");
Trait Implementations§
source§impl Clone for Discriminator
impl Clone for Discriminator
source§fn clone(&self) -> Discriminator
fn clone(&self) -> Discriminator
Returns a copy 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 Default for Discriminator
impl Default for Discriminator
source§fn default() -> Discriminator
fn default() -> Discriminator
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for Discriminator
impl<'de> Deserialize<'de> for Discriminator
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<Discriminator> for Discriminator
impl PartialEq<Discriminator> for Discriminator
source§fn eq(&self, other: &Discriminator) -> bool
fn eq(&self, other: &Discriminator) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for Discriminator
impl Serialize for Discriminator
impl Eq for Discriminator
impl StructuralEq for Discriminator
impl StructuralPartialEq for Discriminator
Auto Trait Implementations§
impl RefUnwindSafe for Discriminator
impl Send for Discriminator
impl Sync for Discriminator
impl Unpin for Discriminator
impl UnwindSafe for Discriminator
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.