pub enum CardinalityRule {
OneToOne,
OneToMany {
min: u32,
max: u32,
},
ManyToOne {
min: u32,
max: u32,
},
ManyToMany {
min_per_source: u32,
max_per_source: u32,
},
}Expand description
Cardinality rule for relationships.
Variants§
OneToOne
One source to one target.
OneToMany
One source to many targets.
ManyToOne
Many sources to one target.
ManyToMany
Many sources to many targets.
Implementations§
Source§impl CardinalityRule
impl CardinalityRule
Sourcepub fn one_to_one() -> Self
pub fn one_to_one() -> Self
Creates a OneToOne cardinality.
Sourcepub fn one_to_many(min: u32, max: u32) -> Self
pub fn one_to_many(min: u32, max: u32) -> Self
Creates a OneToMany cardinality.
Sourcepub fn many_to_one(min: u32, max: u32) -> Self
pub fn many_to_one(min: u32, max: u32) -> Self
Creates a ManyToOne cardinality.
Sourcepub fn many_to_many(min_per_source: u32, max_per_source: u32) -> Self
pub fn many_to_many(min_per_source: u32, max_per_source: u32) -> Self
Creates a ManyToMany cardinality.
Sourcepub fn bounds(&self) -> (u32, u32)
pub fn bounds(&self) -> (u32, u32)
Returns the minimum and maximum counts for this cardinality.
Sourcepub fn is_multi_target(&self) -> bool
pub fn is_multi_target(&self) -> bool
Checks if this cardinality allows multiple targets.
Sourcepub fn is_multi_source(&self) -> bool
pub fn is_multi_source(&self) -> bool
Checks if this cardinality allows multiple sources.
Trait Implementations§
Source§impl Clone for CardinalityRule
impl Clone for CardinalityRule
Source§fn clone(&self) -> CardinalityRule
fn clone(&self) -> CardinalityRule
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 CardinalityRule
impl Debug for CardinalityRule
Source§impl Default for CardinalityRule
impl Default for CardinalityRule
Source§impl<'de> Deserialize<'de> for CardinalityRule
impl<'de> Deserialize<'de> for CardinalityRule
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
Auto Trait Implementations§
impl Freeze for CardinalityRule
impl RefUnwindSafe for CardinalityRule
impl Send for CardinalityRule
impl Sync for CardinalityRule
impl Unpin for CardinalityRule
impl UnwindSafe for CardinalityRule
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