pub struct LinearType {
pub base_type: ParametricType,
pub multiplicity: Multiplicity,
}Expand description
Linear type: type with multiplicity constraints.
Fields§
§base_type: ParametricTypeBase type
multiplicity: MultiplicityMultiplicity constraint
Implementations§
Source§impl LinearType
impl LinearType
Sourcepub fn new(base_type: ParametricType, multiplicity: Multiplicity) -> Self
pub fn new(base_type: ParametricType, multiplicity: Multiplicity) -> Self
Create a new linear type
Sourcepub fn linear(type_name: impl Into<String>) -> Self
pub fn linear(type_name: impl Into<String>) -> Self
Create a linear type (must be used exactly once)
Sourcepub fn unrestricted(type_name: impl Into<String>) -> Self
pub fn unrestricted(type_name: impl Into<String>) -> Self
Create an unrestricted type (any number of times)
Sourcepub fn is_unrestricted(&self) -> bool
pub fn is_unrestricted(&self) -> bool
Check if this is unrestricted
Sourcepub fn make_unrestricted(self) -> Self
pub fn make_unrestricted(self) -> Self
Convert to unrestricted (for copying)
Sourcepub fn make_linear(self) -> Self
pub fn make_linear(self) -> Self
Convert to linear
Trait Implementations§
Source§impl Clone for LinearType
impl Clone for LinearType
Source§fn clone(&self) -> LinearType
fn clone(&self) -> LinearType
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 LinearType
impl Debug for LinearType
Source§impl<'de> Deserialize<'de> for LinearType
impl<'de> Deserialize<'de> for LinearType
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 LinearType
impl Display for LinearType
Source§impl Hash for LinearType
impl Hash for LinearType
Source§impl PartialEq for LinearType
impl PartialEq for LinearType
Source§impl Serialize for LinearType
impl Serialize for LinearType
impl Eq for LinearType
impl StructuralPartialEq for LinearType
Auto Trait Implementations§
impl Freeze for LinearType
impl RefUnwindSafe for LinearType
impl Send for LinearType
impl Sync for LinearType
impl Unpin for LinearType
impl UnwindSafe for LinearType
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