diff --git a/CHANGELOG.md b/CHANGELOG.md index bd9c99abc..96e49795d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## Unreleased + +#### Enhancements + +- Exposed some pretty printing internals for `MastNode` +- Made `KernelLibrary` impl `Clone` and `AsRef` + ## 0.10.0 (2024-08-06) #### Features diff --git a/assembly/src/library/mod.rs b/assembly/src/library/mod.rs index 3888ec8e1..9dcb8cad8 100644 --- a/assembly/src/library/mod.rs +++ b/assembly/src/library/mod.rs @@ -437,12 +437,20 @@ impl Export { /// - All exported procedures must be exported directly from the kernel namespace (i.e., `#sys`). /// - There must be at least one exported procedure. /// - The number of exported procedures cannot exceed [Kernel::MAX_NUM_PROCEDURES] (i.e., 256). +#[derive(Clone)] pub struct KernelLibrary { kernel: Kernel, kernel_info: ModuleInfo, library: Library, } +impl AsRef for KernelLibrary { + #[inline(always)] + fn as_ref(&self) -> &Library { + &self.library + } +} + impl KernelLibrary { /// Returns the inner [`MastForest`]. pub fn mast_forest(&self) -> &MastForest { diff --git a/core/src/mast/node/mod.rs b/core/src/mast/node/mod.rs index 8b42b148f..57f4327e1 100644 --- a/core/src/mast/node/mod.rs +++ b/core/src/mast/node/mod.rs @@ -113,10 +113,7 @@ impl MastNode { matches!(self, Self::Block(_)) } - pub(crate) fn to_pretty_print<'a>( - &'a self, - mast_forest: &'a MastForest, - ) -> impl PrettyPrint + 'a { + pub fn to_pretty_print<'a>(&'a self, mast_forest: &'a MastForest) -> impl PrettyPrint + 'a { match self { MastNode::Block(basic_block_node) => { MastNodePrettyPrint::new(Box::new(basic_block_node))