pub struct NativeWordInput<'a> { /* private fields */ }Expand description
Input adapter for InputProfile::NativeAlignedWords reference tests.
Implementations§
Source§impl<'a> NativeWordInput<'a>
impl<'a> NativeWordInput<'a>
Sourcepub const fn new(bytes: &'a [u8]) -> Self
pub const fn new(bytes: &'a [u8]) -> Self
Wraps an immutable native-word input buffer.
The reference model checks logical offsets, not the address of the
Rust slice. This keeps it equivalent to the JIT’s pre-pointer-add
offset check; adapters whose snapshot contract requires four-byte base
alignment can enforce that separately with Self::new_aligned.
Sourcepub fn new_aligned(bytes: &'a [u8]) -> Option<Self>
pub fn new_aligned(bytes: &'a [u8]) -> Option<Self>
Wraps a native-word input only when its base address is four-byte aligned.
NativeWordInput::new deliberately keeps the logical-offset
contract independent from an incidental Rust slice address. Adapters
whose native snapshot ABI includes a physical base-alignment
precondition can use this constructor at that boundary instead of
silently losing that part of the contract.
Sourcepub fn base_is_aligned(&self) -> bool
pub fn base_is_aligned(&self) -> bool
Returns whether the wrapped byte view starts at a four-byte boundary.
This is intentionally separate from the logical offset checks in
Input::load. x86_64 permits unaligned byte-addressed loads, while
some native-word adapters may require the stronger base-address rule.