1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use crate::{Parse, ParseResult, Parser};
use sway_ast::keywords::{OpenAngleBracketToken, WhereToken};
use sway_ast::ItemStruct;
impl Parse for ItemStruct {
fn parse(parser: &mut Parser) -> ParseResult<ItemStruct> {
Ok(ItemStruct {
visibility: None,
struct_token: parser.parse()?,
name: parser.parse()?,
generics: parser.guarded_parse::<OpenAngleBracketToken, _>()?,
where_clause_opt: parser.guarded_parse::<WhereToken, _>()?,
fields: parser.parse()?,
})
}
}