1use crate::{Guard, Module};
4use core::ops::Deref;
5
6#[derive(Debug)]
8pub struct StaticModule {
9 bytecode: &'static [u8],
10}
11
12impl StaticModule {
13 pub const fn new(bytecode: &'static [u8]) -> Self {
15 Self { bytecode }
16 }
17}
18
19impl<'a> Module<'a> for StaticModule {
20 type Guard = StaticGuard;
21
22 fn bytecode(&'a self) -> Self::Guard {
23 StaticGuard(self.bytecode)
24 }
25}
26
27pub struct StaticGuard(&'static [u8]);
29
30impl Deref for StaticGuard {
31 type Target = [u8];
32
33 fn deref(&self) -> &Self::Target {
34 self.0
35 }
36}
37
38impl Guard for StaticGuard {}