java_lang/tree/node/
module.rs1use std::{
2 borrow::Cow,
3 fmt::{Display, Formatter,Result as FmtResult}
4};
5use crate::{Annotation, DocumentationComment};
6
7#[derive(Debug)]
10pub struct ModuleDeclaration<'a> {
11 pub name: Cow<'a, str>,
13 pub annotations: Vec<Annotation<'a>>,
15 pub directives: Vec<ModuleDirective>,
17 pub open: bool,
19 pub documentation: Option<DocumentationComment<'a>>,
21}
22
23impl<'a> Display for ModuleDeclaration<'a> {
24 fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
25 if let Some(ref d) = self.documentation {
26 Display::fmt(d, f)?;
27 }
28 for i in &self.annotations {
29 write!(f, "{}\n", i)?;
30 }
31 if self.open {
32 write!(f, "open")?;
33 }
34 write!(f, "module {} {{}}", self.name)?;
35 Ok(())
36 }
37}
38
39#[derive(Debug)]
40pub struct ModuleDirective;