Skip to content

Commit

Permalink
feat(rust-parse): parse traits
Browse files Browse the repository at this point in the history
  • Loading branch information
chorman0773 committed Sep 22, 2023
1 parent b570519 commit a269c52
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 343 deletions.
15 changes: 15 additions & 0 deletions rust/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ pub enum ItemBody {
Function(Spanned<Function>),
ExternBlock(Spanned<ExternBlock>),
MacroRules(Spanned<MacroRules>),
Trait(Spanned<TraitDef>),
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct Auto;

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct TraitDef {
pub safety: Option<Spanned<Safety>>,
pub auto: Option<Spanned<Auto>>,
pub name: Spanned<Symbol>,
pub generics: Option<Spanned<GenericParams>>,
pub supertraits: Option<Vec<Spanned<GenericBound>>>,
pub where_clauses: Option<Spanned<Vec<Spanned<WhereClause>>>>,
pub body: Vec<Spanned<Item>>,
}

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
Expand Down
Loading

0 comments on commit a269c52

Please sign in to comment.