zksync_vm2/
mode_requirements.rs1#[derive(Debug, Clone, Copy)]
3pub struct ModeRequirements(pub(crate) u8);
4
5impl ModeRequirements {
6 pub const fn new(kernel_only: bool, cannot_use_in_static: bool) -> Self {
8 Self((kernel_only as u8) | ((cannot_use_in_static as u8) << 1))
9 }
10
11 pub const fn none() -> Self {
13 Self::new(false, false)
14 }
15
16 pub(crate) fn met(self, is_kernel: bool, is_static: bool) -> bool {
17 let enabled_modes = u8::from(is_kernel) | (u8::from(!is_static) << 1);
18 enabled_modes & self.0 == self.0
19 }
20}