Struct LVArray

Source
#[repr(C)]
pub struct LVArray<const D: usize, T> { /* private fields */ }
Expand description

Internal LabVIEW array representation.

todo: does this follow cluster packing rules? yes but lots breaks.

Implementations§

Source§

impl<const D: usize, T> LVArray<D, T>

implement a basic, unsafe API that works for packed usage on 32 bit targets.

It is copy only as we must copy out of the pointers.

Source

pub fn dimension_sizes(&self) -> LVArrayDims<D>

Get the dimensions of the array.

Source

pub fn element_count(&self) -> usize

Get the total number of elements in the array across all dimensions.

Source

pub unsafe fn get_value_unchecked(&self, index: usize) -> T

Get the value directly from the array. This is an unsafe method used on 32 bit targets where the packed structure means we cannot access a slice.

On 64 bit targets use LVArray::data_as_slice instead.

§Safety

If the index is out of the range then it is undefined behaviour.

Source

pub unsafe fn set_value_unchecked(&mut self, index: usize, value: T)

Set the value at the index. This is an unsafe method used on 32 bit targets where the packed structure means we cannot access a slice.

On 64 bit targets use LVArray::data_as_slice_mut instead.

§Safety

If the index is out of range then it is undefined behaviour.

Source§

impl<const D: usize, T> LVArray<D, T>

Source

pub fn data_as_slice(&self) -> &[T]

Get the data component as a slice.

Note: for muti-dimension arrays this is a raw structure so you will need to understand the dimenisons and data ordering.

For 1D arrays this can just be used as the data contents.

Source

pub fn data_as_slice_mut(&mut self) -> &mut [T]

Get the data component as a mutable slice.

Note: for multi-dimension arrays this is a raw structure so you will need to understand the dimensions and data ordering.

For 1D arrays this can just be used as the data contents.

Trait Implementations§

Source§

impl<const D: usize, T> LVCopy for LVArray<D, T>

Auto Trait Implementations§

§

impl<const D: usize, T> Freeze for LVArray<D, T>
where T: Freeze,

§

impl<const D: usize, T> RefUnwindSafe for LVArray<D, T>
where T: RefUnwindSafe,

§

impl<const D: usize, T> Send for LVArray<D, T>
where T: Send,

§

impl<const D: usize, T> !Sized for LVArray<D, T>

§

impl<const D: usize, T> Sync for LVArray<D, T>
where T: Sync,

§

impl<const D: usize, T> Unpin for LVArray<D, T>
where T: Unpin,

§

impl<const D: usize, T> UnwindSafe for LVArray<D, 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