Struct FunArray

Source
pub struct FunArray<const N: u64, T>(/* private fields */);
Expand description

A fixed-size array wrapper with functional semantics and F* integration.

FunArray<N, T> represents an array of T values of length N, where N is a compile-time constant. Internally, it uses a fixed-length array of Option<T> with a maximum capacity of 512 elements. Unused elements beyond N are filled with None.

This type is integrated with F* through various #[hax_lib::fstar::replace] attributes to support formal verification workflows.

Implementations§

Source§

impl FunArray<4, i64>

Source

pub fn into_i32x8(self) -> i32x8

Source§

impl FunArray<8, i32>

Source

pub fn into_i64x4(self) -> i64x4

Source§

impl<const N: u64, T> FunArray<N, T>

Source

pub fn get(&self, i: u64) -> &T

Gets a reference to the element at index i.

Source

pub fn from_fn<F: Fn(u64) -> T>(f: F) -> Self

Constructor for FunArray. FunArray<N,T>::from_fn constructs a funarray out of a function that takes usizes smaller than N and produces an element of type T.

Source

pub fn as_vec(&self) -> Vec<T>
where T: Clone,

Converts the FunArray into a Vec<T>.

Source

pub fn fold<A>(&self, init: A, f: fn(A, T) -> A) -> A
where T: Clone,

Folds over the array, accumulating a result.

§Arguments
  • init - The initial value of the accumulator.
  • f - A function combining the accumulator and each element.
Source§

impl<T: Copy> FunArray<4, T>

Source

pub fn pointwise(self) -> Self

Source§

impl<T: Copy> FunArray<8, T>

Source

pub fn pointwise(self) -> Self

Source§

impl<T: Copy> FunArray<16, T>

Source

pub fn pointwise(self) -> Self

Trait Implementations§

Source§

impl<const N: u64, T: Clone> Clone for FunArray<N, T>

Source§

fn clone(&self) -> FunArray<N, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<const N: u64, T: Debug + Clone> Debug for FunArray<N, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<FunArray<4, i64>> for i32x8

Source§

fn from(vec: i64x4) -> Self

Converts to this type from the input type.
Source§

impl<const N: u64, T> Index<u64> for FunArray<N, T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: u64) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<const N: u64, T: PartialEq> PartialEq for FunArray<N, T>

Source§

fn eq(&self, other: &FunArray<N, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<const N: u64, T: Clone> TryFrom<Vec<T>> for FunArray<N, T>

Source§

type Error = ()

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

fn try_from(v: Vec<T>) -> Result<Self, ()>

Performs the conversion.
Source§

impl<const N: u64, T: Copy> Copy for FunArray<N, T>

Source§

impl<const N: u64, T: Eq> Eq for FunArray<N, T>

Source§

impl<const N: u64, T> StructuralPartialEq for FunArray<N, T>

Auto Trait Implementations§

§

impl<const N: u64, T> Freeze for FunArray<N, T>
where T: Freeze,

§

impl<const N: u64, T> RefUnwindSafe for FunArray<N, T>
where T: RefUnwindSafe,

§

impl<const N: u64, T> Send for FunArray<N, T>
where T: Send,

§

impl<const N: u64, T> Sync for FunArray<N, T>
where T: Sync,

§

impl<const N: u64, T> Unpin for FunArray<N, T>
where T: Unpin,

§

impl<const N: u64, T> UnwindSafe for FunArray<N, T>
where T: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V