1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use crate::{Parse, ParseResult, Parser};
use sway_ast::{ItemStorage, StorageField};
impl Parse for StorageField {
fn parse(parser: &mut Parser) -> ParseResult<StorageField> {
let name = parser.parse()?;
let colon_token = parser.parse()?;
let ty = parser.parse()?;
let eq_token = parser.parse()?;
let initializer = parser.parse()?;
Ok(StorageField {
name,
colon_token,
ty,
eq_token,
initializer,
})
}
}
impl Parse for ItemStorage {
fn parse(parser: &mut Parser) -> ParseResult<ItemStorage> {
let storage_token = parser.parse()?;
let fields = parser.parse()?;
Ok(ItemStorage {
storage_token,
fields,
})
}
}