pub struct LinearType {
pub base_type: String,
pub kind: LinearKind,
pub name: Option<String>,
pub description: Option<String>,
pub tags: Vec<String>,
}Expand description
A linear type with usage constraints.
Fields§
§base_type: StringBase type name
kind: LinearKindLinearity kind
name: Option<String>Optional type name
description: Option<String>Description
Resource tags (for grouping related resources)
Implementations§
Source§impl LinearType
impl LinearType
Sourcepub fn new(base_type: impl Into<String>) -> Self
pub fn new(base_type: impl Into<String>) -> Self
Create a new linear type with default unrestricted kind.
Sourcepub fn linear(base_type: impl Into<String>) -> Self
pub fn linear(base_type: impl Into<String>) -> Self
Create a linear type that must be used exactly once.
Sourcepub fn affine(base_type: impl Into<String>) -> Self
pub fn affine(base_type: impl Into<String>) -> Self
Create an affine type that can be used at most once.
Sourcepub fn relevant(base_type: impl Into<String>) -> Self
pub fn relevant(base_type: impl Into<String>) -> Self
Create a relevant type that must be used at least once.
Sourcepub fn with_kind(self, kind: LinearKind) -> Self
pub fn with_kind(self, kind: LinearKind) -> Self
Set the linearity kind.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description.
Sourcepub fn allows_copy(&self) -> bool
pub fn allows_copy(&self) -> bool
Check if this type allows copying.
Sourcepub fn allows_drop(&self) -> bool
pub fn allows_drop(&self) -> bool
Check if this type allows dropping.
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 moreAuto 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