pub enum Pattern {
Any,
Symbol(String),
String(String),
Integer(i64),
Bool(bool),
Nil,
AnySymbol,
AnyString,
AnyInteger,
OneOf(Vec<String>),
Struct {
head: String,
fields: Vec<(String, Pattern)>,
},
ListHead {
head: String,
tail: Vec<Pattern>,
},
}Expand description
A declarative match-template over SExpr trees.
Variants§
Any
Matches any subtree.
Symbol(String)
Matches the specific symbol.
String(String)
Matches the specific string literal.
Integer(i64)
Matches the specific integer.
Bool(bool)
Matches the specific bool.
Nil
Matches nil.
AnySymbol
Matches any symbol.
AnyString
Matches any string literal.
AnyInteger
Matches any integer.
OneOf(Vec<String>)
Matches any one of the given string literals OR symbols.
Struct
Matches a struct-form (head (:field val) …) where head must
equal head and every declared field must match (extra fields
on the target are ignored — partial match).
ListHead
Matches a list-form (head tail0 tail1 …) where head equals
the expected head symbol and each tail pattern matches positionally.
Implementations§
Trait Implementations§
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnsafeUnpin for Pattern
impl UnwindSafe for Pattern
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