Skip to main content

elm_ast/
module_header.rs

1use crate::exposing::Exposing;
2use crate::ident::ModuleName;
3use crate::node::Spanned;
4
5/// The module header declaration at the top of an Elm file.
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7#[derive(Clone, Debug, PartialEq, Eq)]
8pub enum ModuleHeader {
9    /// `module Foo.Bar exposing (..)`
10    Normal {
11        name: Spanned<ModuleName>,
12        exposing: Spanned<Exposing>,
13    },
14
15    /// `port module Foo.Bar exposing (..)`
16    Port {
17        name: Spanned<ModuleName>,
18        exposing: Spanned<Exposing>,
19    },
20
21    /// `effect module Foo.Bar where { command = MyCmd } exposing (..)`
22    ///
23    /// Effect modules are internal to elm/core and elm/browser.
24    Effect {
25        name: Spanned<ModuleName>,
26        exposing: Spanned<Exposing>,
27        command: Option<Spanned<String>>,
28        subscription: Option<Spanned<String>>,
29    },
30}