-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e45e9f
commit 7bf9423
Showing
12 changed files
with
219 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use std::marker::PhantomData; | ||
use crate::{Doc, Function, Ident, Visibility}; | ||
|
||
#[derive(Debug, Default)] | ||
pub struct Enum<T> { | ||
pub name: Ident, | ||
pub doc: Option<Doc>, | ||
pub variants: Vec<Variant>, | ||
pub vis: Visibility, | ||
/// Attributes in Rust | ||
pub decorators: Vec<T>, | ||
pub methods: Vec<Function<T>>, | ||
} | ||
|
||
#[derive(Debug)] | ||
pub struct Variant { | ||
pub name: Ident, | ||
pub doc: Option<Doc>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::{Class, Doc, Enum, Function, Import}; | ||
|
||
pub struct File<T> { | ||
pub imports: Vec<Import>, | ||
pub doc: Option<Doc>, | ||
/// Code that is before function and class declarations | ||
pub declaration: Option<T>, | ||
pub classes: Vec<Class<T>>, | ||
pub enums: Vec<Enum<T>>, | ||
pub functions: Vec<Function<T>>, | ||
/// Code that follows after the function and class declarations | ||
pub code: Option<T>, | ||
pub package: Option<String>, | ||
} | ||
|
||
impl<T> Default for File<T> where T: Default { | ||
fn default() -> Self { | ||
Self { | ||
doc: None, | ||
declaration: None, | ||
classes: vec![], | ||
enums: vec![], | ||
functions: vec![], | ||
code: None, | ||
imports: vec![], | ||
package: None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.