pub enum ASTPattern {
Symbol(String),
Data(Data),
Chain(Vec<Spanned<ASTPattern>>),
Label(String, Box<Spanned<ASTPattern>>),
Tuple(Vec<Spanned<ASTPattern>>),
}
Expand description
Represents a CSTPattern during the AST phase of compilation. A pattern is like a very general type, because Passerine uses structural row-based typing.
Variants§
Symbol(String)
Data(Data)
Chain(Vec<Spanned<ASTPattern>>)
Label(String, Box<Spanned<ASTPattern>>)
Tuple(Vec<Spanned<ASTPattern>>)
Implementations§
Source§impl ASTPattern
impl ASTPattern
pub fn label(name: String, pattern: Spanned<ASTPattern>) -> ASTPattern
Trait Implementations§
Source§impl Clone for ASTPattern
impl Clone for ASTPattern
Source§fn clone(&self) -> ASTPattern
fn clone(&self) -> ASTPattern
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 ASTPattern
impl Debug for ASTPattern
Source§impl PartialEq for ASTPattern
impl PartialEq for ASTPattern
Source§impl TryFrom<AST> for ASTPattern
impl TryFrom<AST> for ASTPattern
Source§fn try_from(ast: AST) -> Result<Self, Self::Error>
fn try_from(ast: AST) -> Result<Self, Self::Error>
Tries to convert an AST
into a CSTPattern
.
CSTPatterns mirror the AST
s they are designed to destructure.
During parsing, they are just parsed as AST
s -
When the compiler can determine that an AST is actually a pattern,
It performs this conversion.
Source§impl TryFrom<ASTPattern> for CSTPattern
impl TryFrom<ASTPattern> for CSTPattern
impl StructuralPartialEq for ASTPattern
Auto Trait Implementations§
impl Freeze for ASTPattern
impl !RefUnwindSafe for ASTPattern
impl !Send for ASTPattern
impl !Sync for ASTPattern
impl Unpin for ASTPattern
impl !UnwindSafe for ASTPattern
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