pub struct Library {
pub modules: HashMap<ModuleId, Module>,
}Expand description
This represents a fully parsed AirScript program, with imports resolved/parsed, but not merged.
Libraries are produced when parsing files which do not contain a root module. We defer merging the modules together until a root module is provided so that we can perform import resolution on the root module using the contents of the library.
Fields§
§modules: HashMap<ModuleId, Module>Implementations§
Source§impl Library
impl Library
pub fn new( diagnostics: &DiagnosticsHandler, codemap: Arc<CodeMap>, modules: Vec<Module>, ) -> Result<Self, SemanticAnalysisError>
pub fn is_empty(&self) -> bool
pub fn contains(&self, module: &ModuleId) -> bool
pub fn get(&self, module: &ModuleId) -> Option<&Module>
pub fn get_mut(&mut self, module: &ModuleId) -> Option<&mut Module>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Library
impl RefUnwindSafe for Library
impl Send for Library
impl Sync for Library
impl Unpin for Library
impl UnwindSafe for Library
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more