Skip to main content

KStepPointer

Struct KStepPointer 

Source
pub struct KStepPointer<T> { /* private fields */ }
Expand description

Strided pointer to T. Stride = sizeof(T) << k_step bytes.

Implementations§

Source§

impl<T> KStepPointer<T>

Source

pub const SIGNATURE: AxisMask

Direction signature of KStepPointer<T>. Engages the K_stride axis (stride encoded as log2 shift count, no runtime stride: usize field).

Source

pub const unsafe fn new(base: *const T, k_step: u8) -> Self

New strided pointer. k_step is the log2 of the stride multiplier; the actual byte stride is sizeof(T) << k_step.

§Safety

base must point to a valid T and the strided sequence base + i * stride must remain valid for all indices the caller will use.

Source

pub const unsafe fn tight(base: *const T) -> Self

Tight-packed strided pointer (K_step = 0).

§Safety

Same as Self::new: base must point to a contiguous run of T for every index the caller will use.

Source

pub const unsafe fn cache_line(base: *const T) -> Self

Cache-line strided pointer (K_step chosen so stride >= 64 bytes). Walks every 64/sizeof(T) elements.

§Safety

Same as Self::new: base must remain valid for every index the caller will use under the chosen k_step stride.

Source

pub const fn base(&self) -> *const T

Source

pub const fn k_step(&self) -> u8

Source

pub const fn stride(&self) -> usize

Byte stride between consecutive elements.

Source

pub unsafe fn at(&self, i: usize) -> *const T

Pointer to the i-th element under the current stride.

§Safety

The caller must ensure base + i * stride is in bounds.

Source

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

Borrow the i-th element.

§Safety

i must be in bounds; the strided sequence at this index must point to a valid T.

Source

pub unsafe fn iter(&self, count: usize) -> StridedIter<'_, T>

Iterator over count strided elements.

§Safety

All count strided positions must be in bounds.

Trait Implementations§

Source§

impl<T> Clone for KStepPointer<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Copy for KStepPointer<T>

Source§

impl<T: Debug> Debug for KStepPointer<T>

Source§

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

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

impl<T: Send> Send for KStepPointer<T>

Source§

impl<T: Sync> Sync for KStepPointer<T>

Auto Trait Implementations§

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.