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. TODO: Move
51/// into dedicated crate and access via
52// `test_deps`.
53pub mod strategy;
54
55/// Utilities.
56pub mod utils;
57
58/// A small parsing library for identifiers.
59pub mod parse;
60
61/// Types to describe extents, points and views.
62pub mod view;
63/// Describes the shape of a coordinate space.
64pub use view::Extent;
65/// Errors that can occur during extent construction or validation.
66pub use view::ExtentError;
67/// Extension trait for creating points from coordinate vectors.
68pub use view::InExtent;
69/// Representation of a point in a coordinate space.
70pub use view::Point;
71/// Errors that can occur during point construction or validation.
72pub use view::PointError;
73/// Represents a logical view or projection.
74pub use view::Region;
75/// Trait for data structures from which views can be created.
76pub use view::View;
77/// Extension methods for view construction.
78pub use view::ViewExt;
79/// The iterator over views.
80pub use view::ViewIterator;