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#![recursion_limit = "512"]
21
22mod slice;
23pub use slice::DimSliceIterator;
24pub use slice::Slice;
25pub use slice::SliceError;
26pub use slice::SliceIterator;
27
28/// Selection algebra for describing multidimensional mesh regions.
29pub mod selection;
30
31/// Core types for representing multidimensional shapes and strides.
32pub mod shape;
33
34/// Reshaping transformations for multidimensional slices and shapes.
35pub mod reshape;
36
37/// The selection expression type used to define routing constraints.
38pub use selection::Selection;
39/// DSL-style constructors for building `Selection` expressions.
40pub use selection::dsl;
41/// Represents an interval with an optional end and step, used to
42/// define extents in `Shape` and coordinate filters in `Selection`.
43pub use shape::Range;
44/// Describes the size and layout of a multidimensional mesh.
45pub use shape::Shape;
46/// Errors that can occur during shape construction or validation.
47pub use shape::ShapeError;
48
49/// Property-based generators for randomized test input. TODO: Move
50/// into dedicated crate and access via
51// `test_deps`.
52pub mod strategy;
53
54/// Utilities.
55pub mod utils;
56
57/// A small parsing library for identifiers.
58pub mod parse;
59
60/// Types to describe extents, points and views.
61pub mod view;
62/// Describes the shape of a coordinate space.
63pub use view::Extent;
64/// Errors that can occur during extent construction or validation.
65pub use view::ExtentError;
66/// Extension trait for creating points from coordinate vectors.
67pub use view::InExtent;
68/// Representation of a point in a coordinate space.
69pub use view::Point;
70/// Errors that can occur during point construction or validation.
71pub use view::PointError;
72/// Represents a logical view or projection.
73pub use view::Region;
74/// Trait for data structures from which views can be created.
75pub use view::View;
76/// Extension methods for view construction.
77pub use view::ViewExt;
78/// The iterator over views.
79pub use view::ViewIterator;