From a1c60c9c75bbec87633eb75e5e242952accaf763 Mon Sep 17 00:00:00 2001 From: Paul Schoenfelder Date: Sat, 10 Aug 2024 02:54:53 -0400 Subject: [PATCH] fix: ensure kernel library is usable as a library --- CHANGELOG.md | 7 +++++++ assembly/src/library/mod.rs | 8 ++++++++ 2 files changed, 15 insertions(+) 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 {