pub struct Module {
pub items: Vec<ModuleItem>,
pub errors: Vec<ParseError>,
pub comments: Vec<Vec<Comment>>,
}Expand description
An ordered file of imports and sheet definitions, without resolved names or types.
Errors include malformed file items and errors recovered inside definitions.
§Examples
let module = adam_lang::AdamAstParser::new().parse_module_str(
"use math::ops as operations;
sheet component(input: i32, result: i32) {
relationship { result := input; }
}
sheet root {
source x: i32 = 1 filter 0..=10 require { @positive x > 0; };
cell y: i32;
cell z: i32;
out pair: (i32, i32) := (x, y);
relationship component(input: x, result: y);
conditional true {
true => { relationship { (y, z) := (x, x); } }
_ => { relationship { y := x; } }
}
}"
).unwrap();
assert!(module.errors.is_empty());
assert_eq!(module.items.len(), 3);Fields§
§items: Vec<ModuleItem>File items in source order, including recovery placeholders.
errors: Vec<ParseError>Recovered syntax errors in source order.
comments: Vec<Vec<Comment>>Comments before each item and after the last item, populated by trivia attachment.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Module
impl !Send for Module
impl !Sync for Module
impl !UnwindSafe for Module
impl Freeze for Module
impl Unpin for Module
impl UnsafeUnpin for Module
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more