devela/num/geom/metric/stride.rs
1// devela::num::geom::metric::stride
2//
3//! Defines [`Stride`].
4//
5
6#[doc = crate::TAG_GEOM!()]
7/// A step size for traversing dimensions or repetitions.
8///
9/// `Stride` defines the spacing between adjacent elements in a structured layout.
10/// It does not define structure itself, but rather **how elements are accessed within it**.
11///
12/// - In **1D**, `Stride<T, 1>` represents uniform step spacing (e.g. sampling rate).
13/// - In **nD**, `Stride<T, N>` defines the step sizes across `N` dimensions.
14///
15/// Common applications:
16/// - **Numerical computing** (matrix row/column strides)
17/// - **Memory layouts** (pixel buffers, structured arrays)
18/// - **Geometric traversal** (lattices, grids, fractal stepping)
19#[must_use]
20#[repr(transparent)]
21pub struct Stride<T, const D: usize> {
22 /// The step sizes per dimension.
23 pub dim: [T; D],
24}
25crate::_impl_metric![common_methods: Stride];
26crate::_impl_metric![common_traits: Stride];