use crate::{Guard, Module};
use core::ops::Deref;
#[derive(Debug)]
pub struct StaticModule {
bytecode: &'static [u8],
}
impl StaticModule {
pub const fn new(bytecode: &'static [u8]) -> Self {
Self { bytecode }
}
}
impl<'a> Module<'a> for StaticModule {
type Guard = StaticGuard;
fn bytecode(&'a self) -> Self::Guard {
StaticGuard(self.bytecode)
}
}
pub struct StaticGuard(&'static [u8]);
impl Deref for StaticGuard {
type Target = [u8];
fn deref(&self) -> &Self::Target {
self.0
}
}
impl Guard for StaticGuard {}