ndslice/
lib.rs

1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the root directory of this source tree.
7 */
8
9//! Core mesh components for the hyperactor framework.
10//!
11//! Provides [`Slice`], a compact representation of a subset of a
12//! multidimensional array. See [`Slice`] for more details.
13//!
14//! This crate defines the foundational abstractions used in
15//! hyperactor's mesh layer, including multidimensional shapes and
16//! selection algebra. The crate avoids dependencies on procedural
17//! macros and other higher-level constructs, enabling reuse in both
18//! runtime and macro contexts.
19
20#![feature(assert_matches)]
21#![recursion_limit = "512"]
22
23mod slice;
24pub use slice::DimSliceIterator;
25pub use slice::Slice;
26pub use slice::SliceError;
27pub use slice::SliceIterator;
28
29/// Selection algebra for describing multidimensional mesh regions.
30pub mod selection;
31
32/// Core types for representing multidimensional shapes and strides.
33pub mod shape;
34
35/// Reshaping transformations for multidimensional slices and shapes.
36pub mod reshape;
37
38/// The selection expression type used to define routing constraints.
39pub use selection::Selection;
40/// DSL-style constructors for building `Selection` expressions.
41pub use selection::dsl;
42/// Represents an interval with an optional end and step, used to
43/// define extents in `Shape` and coordinate filters in `Selection`.
44pub use shape::Range;
45/// Describes the size and layout of a multidimensional mesh.
46pub use shape::Shape;
47/// Errors that can occur during shape construction or validation.
48pub use shape::ShapeError;
49
50/// Property-based generators for randomized test input.
51#[cfg(test)]
52pub mod strategy;
53
54/// Utilities.
55pub mod utils;
56
57/// Types to describe extents, points and views.
58pub mod view;
59/// Describes the shape of a coordinate space.
60pub use view::Extent;
61/// Errors that can occur during extent construction or validation.
62pub use view::ExtentError;
63/// Extension trait for creating points from coordinate vectors.
64pub use view::InExtent;
65/// Representation of a point in a coordinate space.
66pub use view::Point;
67/// Errors that can occur during point construction or validation.
68pub use view::PointError;
69/// Represents a logical view or projection.
70pub use view::View;
71/// Extension methods for view construction.
72pub use view::ViewExt;
73/// The iterator over views.
74pub use view::ViewIterator;
75/// Trait for data structures from which views can be created.
76pub use view::Viewable;