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