pub enum Declaration {
FunctionDeclaration(Box<Function>),
AliasDeclaration(TypeAlias),
CustomTypeDeclaration(CustomType),
PortDeclaration(Signature),
InfixDeclaration(InfixDef),
Destructuring {
pattern: Spanned<Pattern>,
body: Spanned<Expr>,
},
}Expand description
A top-level declaration in an Elm module.
Variants§
FunctionDeclaration(Box<Function>)
A function or value definition.
add : Int -> Int -> Int
add x y = x + yAliasDeclaration(TypeAlias)
A type alias declaration.
type alias Model =
{ count : Int
, name : String
}CustomTypeDeclaration(CustomType)
A custom type (ADT / tagged union) declaration.
type Msg
= Increment
| Decrement
| SetName StringPortDeclaration(Signature)
A port declaration.
port sendMessage : String -> Cmd msgInfixDeclaration(InfixDef)
An infix operator declaration (only in core packages).
infix left 6 (+) = addDestructuring
A top-level destructuring (rare, but valid).
{ name, age } = personTrait 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 (const: unstable) · 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
Source§fn eq(&self, other: &Declaration) -> bool
fn eq(&self, other: &Declaration) -> bool
Tests for
self and other values to be equal, and is used by ==.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 UnsafeUnpin 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