Commit 81756e6
authored
Add a trait to tie together compile-time and runtime number of dimensions (#1575)
This is the next PR to address #1506. In the previous PR (#1568) we
established a trait for capturing the "dimensionality" or "rank" of an
array at the type level. This PR is focused on providing a bridge from
type-level dimensionality to runtime dimensionality, which we do through
the new `Ranked` trait.
The `Ranked` trait is pretty simple: require an associated type (`NDim`)
that carries compile-time dimensionality, and a function `fn ndim(&self)
-> usize` that tells the user runtime dimensionality. The
`src/layout/ranked.rs` file contains the definition, implementations,
and blanket implementations.
This commit also does some moves and renames of the existing
`Dimensionality` trait, renaming it to `Rank`, as well as many of
the types in that file.1 parent 5056ef8 commit 81756e6
File tree
8 files changed
+323
-147
lines changed- src
- dimension
- layout
8 files changed
+323
-147
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
78 | 79 | | |
79 | 80 | | |
80 | 81 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | 82 | | |
89 | 83 | | |
90 | 84 | | |
| |||
420 | 414 | | |
421 | 415 | | |
422 | 416 | | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
423 | 429 | | |
424 | 430 | | |
425 | 431 | | |
426 | 432 | | |
427 | 433 | | |
428 | 434 | | |
429 | | - | |
430 | | - | |
431 | 435 | | |
432 | 436 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | 437 | | |
439 | 438 | | |
440 | 439 | | |
| |||
478 | 477 | | |
479 | 478 | | |
480 | 479 | | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | 480 | | |
489 | 481 | | |
490 | 482 | | |
| |||
613 | 605 | | |
614 | 606 | | |
615 | 607 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | 608 | | |
624 | 609 | | |
625 | 610 | | |
| |||
790 | 775 | | |
791 | 776 | | |
792 | 777 | | |
793 | | - | |
794 | | - | |
795 | | - | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | 778 | | |
801 | 779 | | |
802 | 780 | | |
| |||
924 | 902 | | |
925 | 903 | | |
926 | 904 | | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
931 | 905 | | |
932 | 906 | | |
933 | 907 | | |
| |||
968 | 942 | | |
969 | 943 | | |
970 | 944 | | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
971 | 956 | | |
972 | 957 | | |
973 | 958 | | |
| |||
976 | 961 | | |
977 | 962 | | |
978 | 963 | | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | 964 | | |
987 | 965 | | |
988 | 966 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
0 commit comments