pub enum OcamlPattern {
Wildcard,
Var(String),
Const(OcamlLit),
Tuple(Vec<OcamlPattern>),
Cons(Box<OcamlPattern>, Box<OcamlPattern>),
List(Vec<OcamlPattern>),
Ctor(String, Vec<OcamlPattern>),
Record(Vec<(String, OcamlPattern)>),
Or(Box<OcamlPattern>, Box<OcamlPattern>),
As(Box<OcamlPattern>, String),
}Expand description
OCaml pattern for match arms.
Variants§
Wildcard
_ (wildcard)
Var(String)
x (bind to variable)
Const(OcamlLit)
A constant pattern: 42, true, 'a', "hello"
Tuple(Vec<OcamlPattern>)
A tuple pattern: (p1, p2, ...)
Cons(Box<OcamlPattern>, Box<OcamlPattern>)
A cons pattern: h :: t
List(Vec<OcamlPattern>)
A list pattern: [p1; p2; ...]
Ctor(String, Vec<OcamlPattern>)
A constructor pattern: Some p, Error e, Leaf, Node (l, v, r)
Record(Vec<(String, OcamlPattern)>)
A record pattern: { field1 = p1; field2 = p2; ... }
Or(Box<OcamlPattern>, Box<OcamlPattern>)
An or-pattern: p1 | p2
As(Box<OcamlPattern>, String)
An as-pattern: p as x
Trait Implementations§
Source§impl Clone for OcamlPattern
impl Clone for OcamlPattern
Source§fn clone(&self) -> OcamlPattern
fn clone(&self) -> OcamlPattern
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 OcamlPattern
impl Debug for OcamlPattern
Source§impl Display for OcamlPattern
impl Display for OcamlPattern
Source§impl PartialEq for OcamlPattern
impl PartialEq for OcamlPattern
impl StructuralPartialEq for OcamlPattern
Auto Trait Implementations§
impl Freeze for OcamlPattern
impl RefUnwindSafe for OcamlPattern
impl Send for OcamlPattern
impl Sync for OcamlPattern
impl Unpin for OcamlPattern
impl UnsafeUnpin for OcamlPattern
impl UnwindSafe for OcamlPattern
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