#[non_exhaustive]pub enum Cardinality {
OneToMany,
ManyToOne,
OneToOne,
}Expand description
Relationship cardinality between REST resources.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
OneToMany
Parent has many children (array embed).
ManyToOne
Child points to one parent (object embed).
OneToOne
Exactly one related resource (object or null).
Implementations§
Source§impl Cardinality
impl Cardinality
Sourcepub const fn is_to_one(self) -> bool
pub const fn is_to_one(self) -> bool
Whether an embed of this cardinality answers with one object rather than a collection.
The two object cardinalities are the ones whose join key must identify at most one
target row, because there is no second row for the answer to carry; see
relationship_violations.
Stated here for the reason Relationship::parent_join_column is: a caller
keeping its own copy of which variants are “to-one” would classify a future variant
silently, and the two opinions would drift.
Trait Implementations§
Source§impl Clone for Cardinality
impl Clone for Cardinality
impl Copy for Cardinality
Source§impl Debug for Cardinality
impl Debug for Cardinality
Source§impl<'de> Deserialize<'de> for Cardinality
impl<'de> Deserialize<'de> for Cardinality
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
impl Eq for Cardinality
Source§impl PartialEq for Cardinality
impl PartialEq for Cardinality
Source§impl Serialize for Cardinality
impl Serialize for Cardinality
impl StructuralPartialEq for Cardinality
Auto Trait Implementations§
impl Freeze for Cardinality
impl RefUnwindSafe for Cardinality
impl Send for Cardinality
impl Sync for Cardinality
impl Unpin for Cardinality
impl UnsafeUnpin for Cardinality
impl UnwindSafe for Cardinality
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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
Compare self to
key and return true if they are equal.