miden_assembly/linker/
library.rs1use alloc::{sync::Arc, vec::Vec};
2
3use miden_assembly_syntax::module::ModuleInfo;
4use miden_core::Word;
5use miden_mast_package::{ManifestValidationError, MastForest, Package};
6pub use miden_project::Linkage;
7
8#[derive(Clone)]
11pub struct LinkLibrary {
12 pub package: Arc<Package>,
13 pub linkage: Linkage,
15}
16
17impl LinkLibrary {
18 pub fn from_package(package: Arc<Package>) -> Self {
20 Self { package, linkage: Linkage::Dynamic }
21 }
22
23 pub fn with_linkage(mut self, linkage: Linkage) -> Self {
25 self.linkage = linkage;
26 self
27 }
28
29 #[inline(always)]
31 pub fn commitment(&self) -> Word {
32 self.mast().commitment()
33 }
34
35 #[inline(always)]
36 pub fn mast(&self) -> &Arc<MastForest> {
37 self.package.mast_forest()
38 }
39
40 #[inline]
41 pub fn module_infos(&self) -> Result<Vec<ModuleInfo>, ManifestValidationError> {
42 self.package.try_module_infos()
43 }
44}