pub struct Declaration {
pub pattern: Pattern,
pub prefix_parameters: Vec<Typed>,
pub signature: Expression,
pub body: Expression,
pub is_recursive: bool,
}
Expand description
Decl
in Mini-TT.
$D ::= p:A=M\ |\ \textsf{rec}\ p:A=M$
It’s supposed to be an enum
because it can be rec or non-rec, but for
coding convenience I’ve made it a struct with a bool
member
(is_recursive
) to indicate whether it’s recursive.
Fields§
§pattern: Pattern
$p$ in syntax.
prefix_parameters: Vec<Typed>
This is an extension – declarations can be prefixed with some parameters.
signature: Expression
$A$ in syntax.
body: Expression
$M$ in syntax.
is_recursive: bool
Whether the $\textsf{rec}$ is present.
Implementations§
Source§impl Declaration
impl Declaration
Sourcepub fn new(
pattern: Pattern,
prefix_parameters: Vec<Typed>,
signature: Expression,
body: Expression,
is_recursive: bool,
) -> Self
pub fn new( pattern: Pattern, prefix_parameters: Vec<Typed>, signature: Expression, body: Expression, is_recursive: bool, ) -> Self
Constructor
Sourcepub fn simple(
pattern: Pattern,
prefix_parameters: Vec<Typed>,
signature: Expression,
body: Expression,
) -> Self
pub fn simple( pattern: Pattern, prefix_parameters: Vec<Typed>, signature: Expression, body: Expression, ) -> Self
Non-recursive declarations
Sourcepub fn recursive(
pattern: Pattern,
prefix_parameters: Vec<Typed>,
signature: Expression,
body: Expression,
) -> Self
pub fn recursive( pattern: Pattern, prefix_parameters: Vec<Typed>, signature: Expression, body: Expression, ) -> Self
Recursive declarations
Trait Implementations§
Source§impl Clone for Declaration
impl Clone for Declaration
Source§fn clone(&self) -> Declaration
fn clone(&self) -> Declaration
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 Declaration
impl Debug for Declaration
Source§impl Display for Declaration
impl Display for Declaration
Source§impl PartialEq for Declaration
impl PartialEq for Declaration
impl Eq for Declaration
impl StructuralPartialEq for Declaration
Auto Trait Implementations§
impl Freeze for Declaration
impl RefUnwindSafe for Declaration
impl !Send for Declaration
impl !Sync for Declaration
impl Unpin for Declaration
impl UnwindSafe for Declaration
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