miden-protocol 0.16.0-beta.1

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, ModuleKind, ModuleParser, Package, Path};

/// Assembles a single-module test library.
pub fn assemble_test_library(name: &str, path: &str, source: &str) -> Package {
    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")
}