Skip to main content

ferray_core/array/
mod.rs

1// ferray-core: Array module — NdArray<T, D> and ownership variants (REQ-1, REQ-3)
2//
3// NdArray wraps ndarray::ArrayBase internally. ndarray is NEVER part of the
4// public API surface.
5
6pub mod aliases;
7pub mod arc;
8pub mod cow;
9pub mod display;
10mod index_impl;
11pub mod introspect;
12pub mod iter;
13pub mod methods;
14pub mod owned;
15pub mod reductions;
16#[cfg(feature = "serde")]
17mod serde_impl;
18pub mod sort;
19pub mod view;
20pub mod view_mut;
21
22/// Flags describing the memory properties of an array.
23///
24/// Mirrors `NumPy`'s `arr.flags` field: a flat collection of independent
25/// boolean memory-layout properties. The names map 1:1 to `NumPy` and are
26/// accessed individually by callers, so a bitfield-style enum would
27/// hurt ergonomics rather than help.
28#[allow(clippy::struct_excessive_bools)]
29#[derive(Debug, Clone, Copy, PartialEq, Eq)]
30pub struct ArrayFlags {
31    /// Whether the data is C-contiguous (row-major).
32    pub c_contiguous: bool,
33    /// Whether the data is Fortran-contiguous (column-major).
34    pub f_contiguous: bool,
35    /// Whether the array owns its data.
36    pub owndata: bool,
37    /// Whether the array is writeable.
38    pub writeable: bool,
39    /// Whether the underlying data pointer is properly aligned for the
40    /// element type (#345). Mirrors numpy's NPY_ARRAY_ALIGNED flag.
41    ///
42    /// Owned arrays produced through ferray's safe constructors are
43    /// always aligned because they go through `Vec<T>` which the
44    /// allocator guarantees to align for `T`. Views constructed via
45    /// `from_shape_ptr` from a raw pointer can be misaligned and
46    /// will report `aligned = false` here so callers can detect the
47    /// degenerate case before passing into a SIMD path.
48    pub aligned: bool,
49}
50
51// Re-export the main types at this module level for convenience.
52pub use self::arc::ArcArray;
53pub use self::cow::CowArray;
54pub use self::owned::Array;
55pub use self::view::ArrayView;
56pub use self::view_mut::ArrayViewMut;