1use crate::interface::Interface;
2use crate::{Class, Doc, Enum, Function, Import, Visibility};
3
4pub enum Item<T> {
5 Class(Class<T>),
6 Enum(Enum<T>),
7 Interface(Interface<T>),
8 Fn(Function<T>),
9 Block(T),
10}
11
12pub struct Module {
13 pub name: String,
14 pub vis: Visibility,
15}
16
17impl Module {
18 pub fn new(name: impl Into<String>) -> Self {
19 Self {
20 name: name.into(),
21 vis: Visibility::Private,
22 }
23 }
24
25 pub fn new_pub(name: impl Into<String>) -> Self {
26 Self {
27 name: name.into(),
28 vis: Visibility::Public,
29 }
30 }
31}
32
33pub struct File<T> {
34 pub attributes: Vec<T>,
35 pub doc: Option<Doc>,
36 pub imports: Vec<Import>,
37 pub modules: Vec<Module>,
38 pub items: Vec<Item<T>>,
40}
41
42impl<T> Default for File<T>
43where
44 T: Default,
45{
46 fn default() -> Self {
47 Self {
48 attributes: vec![],
49 doc: None,
50 imports: vec![],
51 items: vec![],
52 modules: Vec::new(),
53 }
54 }
55}