pub struct VariantDeclaration { /* private fields */ }Expand description
One named variant of an AlgebraicDataType, with its ordered fields.
Implementations§
Source§impl VariantDeclaration
impl VariantDeclaration
Sourcepub fn new(symbol: Symbol, fields: Vec<PatternField>) -> Self
pub fn new(symbol: Symbol, fields: Vec<PatternField>) -> Self
Builds a variant with the given tag symbol and ordered fields.
Sourcepub fn nullary(symbol: Symbol) -> Self
pub fn nullary(symbol: Symbol) -> Self
Builds a field-less (nullary) variant such as an enum tag.
Sourcepub fn fields(&self) -> &[PatternField]
pub fn fields(&self) -> &[PatternField]
Returns the variant fields in declaration order.
Trait Implementations§
Source§impl Clone for VariantDeclaration
impl Clone for VariantDeclaration
Source§fn clone(&self) -> VariantDeclaration
fn clone(&self) -> VariantDeclaration
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 !RefUnwindSafe for VariantDeclaration
impl !UnwindSafe for VariantDeclaration
impl Freeze for VariantDeclaration
impl Send for VariantDeclaration
impl Sync for VariantDeclaration
impl Unpin for VariantDeclaration
impl UnsafeUnpin for VariantDeclaration
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