Skip to main content

NativeWordInput

Struct NativeWordInput 

Source
pub struct NativeWordInput<'a> { /* private fields */ }
Expand description

Input adapter for InputProfile::NativeAlignedWords reference tests.

Implementations§

Source§

impl<'a> NativeWordInput<'a>

Source

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.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Input for NativeWordInput<'_>

Source§

fn len(&self) -> u32

Returns the length value observed by LD_LEN and LDX_LEN.
Source§

fn load(&self, offset: u32, width: LoadWidth) -> Option<u32>

Loads one value at an already resolved absolute offset.
Source§

fn is_empty(&self) -> bool

Returns whether the input length is zero.

Auto Trait Implementations§

§

impl<'a> Forget for NativeWordInput<'a>

§

impl<'a> Freeze for NativeWordInput<'a>

§

impl<'a> RefUnwindSafe for NativeWordInput<'a>

§

impl<'a> Send for NativeWordInput<'a>

§

impl<'a> Sync for NativeWordInput<'a>

§

impl<'a> Unpin for NativeWordInput<'a>

§

impl<'a> UnsafeUnpin for NativeWordInput<'a>

§

impl<'a> UnwindSafe for NativeWordInput<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.