devela 0.27.0

A development layer of coherence.
Documentation
// devela::geom::metric::stride
//
//! Defines [`Stride`].
//

#[doc = crate::_tags!(geom)]
/// A step size for traversing dimensions or repetitions.
#[doc = crate::_doc_location!("geom/metric")]
///
/// `Stride` defines the spacing between adjacent elements in a structured layout.
/// It does not define structure itself, but rather **how elements are accessed within it**.
///
/// - In **1D**, `Stride<T, 1>` represents uniform step spacing (e.g. sampling rate).
/// - In **nD**, `Stride<T, N>` defines the step sizes across `N` dimensions.
///
/// Common applications:
/// - **Numerical computing** (matrix row/column strides)
/// - **Memory layouts** (pixel buffers, structured arrays)
/// - **Geometric traversal** (lattices, grids, fractal stepping)
#[must_use]
#[repr(transparent)]
pub struct Stride<T, const D: usize> {
    /// The step sizes per dimension.
    pub dim: [T; D],
}

#[doc = crate::_tags!(geom)]
/// A 1-dimensional [`Stride`].
#[doc = crate::_doc_location!("geom/metric")]
pub type Stride1<T> = Stride<T, 1>;

#[doc = crate::_tags!(geom)]
/// A 2-dimensional [`Stride`].
#[doc = crate::_doc_location!("geom/metric")]
pub type Stride2<T> = Stride<T, 2>;

#[doc = crate::_tags!(geom)]
/// A 3-dimensional [`Stride`].
#[doc = crate::_doc_location!("geom/metric")]
pub type Stride3<T> = Stride<T, 3>;

crate::_impl_geom_dim![common_methods: Stride];
crate::_impl_geom_dim![common_traits: Stride];