Skip to content

Commit 113f56c

Browse files
committed
DOC: Doc fields for Slice and SliceInfoElem
1 parent 653f912 commit 113f56c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/slice.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::ops::{Deref, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, Rang
1616

1717
/// A slice (range with step size).
1818
///
19-
/// `end` is an exclusive index. Negative `begin` or `end` indexes are counted
19+
/// `end` is an exclusive index. Negative `start` or `end` indexes are counted
2020
/// from the back of the axis. If `end` is `None`, the slice extends to the end
2121
/// of the axis.
2222
///
@@ -36,8 +36,12 @@ use std::ops::{Deref, Range, RangeFrom, RangeFull, RangeInclusive, RangeTo, Rang
3636
/// The Python equivalent is `[a::-1]`.
3737
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
3838
pub struct Slice {
39+
/// start index; negative are counted from the back of the axis
3940
pub start: isize,
41+
/// end index; negative are counted from the back of the axis; when not present
42+
/// the default is the full length of the axis.
4043
pub end: Option<isize>,
44+
/// step size in elements; the default is 1, for every element.
4145
pub step: isize,
4246
}
4347

@@ -105,12 +109,16 @@ pub struct NewAxis;
105109
/// `[np.newaxis]`. The macro equivalent is `s![NewAxis]`.
106110
#[derive(Debug, PartialEq, Eq, Hash)]
107111
pub enum SliceInfoElem {
108-
/// A range with step size. `end` is an exclusive index. Negative `begin`
112+
/// A range with step size. `end` is an exclusive index. Negative `start`
109113
/// or `end` indexes are counted from the back of the axis. If `end` is
110114
/// `None`, the slice extends to the end of the axis.
111115
Slice {
116+
/// start index; negative are counted from the back of the axis
112117
start: isize,
118+
/// end index; negative are counted from the back of the axis; when not present
119+
/// the default is the full length of the axis.
113120
end: Option<isize>,
121+
/// step size in elements; the default is 1, for every element.
114122
step: isize,
115123
},
116124
/// A single index.

0 commit comments

Comments
 (0)