pub enum Multiplicity {
Linear,
Affine,
Relevant,
Unrestricted,
}Expand description
Multiplicity: how many times a value can be used.
Variants§
Linear
Linear: must be used exactly once (1)
Affine
Affine: must be used at most once (0..1)
Relevant
Relevant: must be used at least once (1..)
Unrestricted
Unrestricted: can be used any number of times (0..)
Implementations§
Source§impl Multiplicity
impl Multiplicity
Sourcepub fn allows(&self, n: usize) -> bool
pub fn allows(&self, n: usize) -> bool
Check if a value with this multiplicity can be used n times
Sourcepub fn is_unrestricted(&self) -> bool
pub fn is_unrestricted(&self) -> bool
Check if this is unrestricted (any number of times)
Sourcepub fn combine(&self, other: &Multiplicity) -> Multiplicity
pub fn combine(&self, other: &Multiplicity) -> Multiplicity
Combine multiplicities (for products/tuples)
Sourcepub fn join(&self, other: &Multiplicity) -> Multiplicity
pub fn join(&self, other: &Multiplicity) -> Multiplicity
Join multiplicities (for sums/unions)
Trait Implementations§
Source§impl Clone for Multiplicity
impl Clone for Multiplicity
Source§fn clone(&self) -> Multiplicity
fn clone(&self) -> Multiplicity
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 Multiplicity
impl Debug for Multiplicity
Source§impl<'de> Deserialize<'de> for Multiplicity
impl<'de> Deserialize<'de> for Multiplicity
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 Display for Multiplicity
impl Display for Multiplicity
Source§impl Hash for Multiplicity
impl Hash for Multiplicity
Source§impl PartialEq for Multiplicity
impl PartialEq for Multiplicity
Source§impl Serialize for Multiplicity
impl Serialize for Multiplicity
impl Eq for Multiplicity
impl StructuralPartialEq for Multiplicity
Auto Trait Implementations§
impl Freeze for Multiplicity
impl RefUnwindSafe for Multiplicity
impl Send for Multiplicity
impl Sync for Multiplicity
impl Unpin for Multiplicity
impl UnwindSafe for Multiplicity
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