miden-protocol 0.16.0-alpha.4

Core components of the Miden protocol
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use alloc::sync::Arc;

use crate::assembly::{Assembler, DefaultSourceManager, Library, ModuleKind, ModuleParser, Path};

/// Assembles a single-module test library.
pub fn assemble_test_library(name: &str, path: &str, source: &str) -> Library {
    let source_manager = Arc::new(DefaultSourceManager::default());
    let root = ModuleParser::new(Some(ModuleKind::Library))
        .parse_str(Some(Path::new(path)), source, source_manager.clone())
        .expect("test library source should parse");

    *Assembler::new(source_manager)
        .assemble_library(name, root, None::<&str>)
        .expect("test library source should assemble")
}