Skip to main content

wright/ast/decl/
module.rs

1//! Module declarations, such as `mod math;` or `mod math { ... }`.
2
3use super::Item;
4use crate::ast::{DocComment, identifier::Identifier};
5use crate::source_tracking::fragment::Fragment;
6
7/// A module declaration.
8#[derive(Debug, Clone, PartialEq)]
9pub struct ModuleDecl {
10    /// Full matching source of the declaration.
11    pub matching_source: Fragment,
12
13    /// The name of the module.
14    pub name: Identifier,
15
16    /// Inner doc comments (`//!` and `/*! */`) at the start of an inline module's body.
17    pub inner_docs: Vec<DocComment>,
18
19    /// The items of an inline module (`mod name { ... }`), or [None] for a module declared to be in another file
20    /// (`mod name;`).
21    pub items: Option<Vec<Item>>,
22}