diff options
| author | wr7 <d-wr7@outlook.com> | 2024-11-09 16:28:15 -0600 |
|---|---|---|
| committer | wr7 <d-wr7@outlook.com> | 2024-11-09 17:02:27 -0600 |
| commit | 3c8bfb7f7bc586afb597155184a14d1a4fe0d244 (patch) | |
| tree | ebb9f748ddc70faa9a5694daacf1d3e70be0e786 /library | |
| parent | b8407d9852dd4a11385390165b553f64b114f59a (diff) | |
| download | rust-3c8bfb7f7bc586afb597155184a14d1a4fe0d244.tar.gz rust-3c8bfb7f7bc586afb597155184a14d1a4fe0d244.zip | |
Improve documentation of `element_offset` and related methods
Diffstat (limited to 'library')
| -rw-r--r-- | library/core/src/slice/mod.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 39541e85303..d0a9af09ea8 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -4533,7 +4533,7 @@ impl<T> [T] { /// Returns the index that an element reference points to. /// - /// Returns `None` if `element` does not point within the slice or if it points between elements. + /// Returns `None` if `element` does not point to the start of an element within the slice. /// /// This method is useful for extending slice iterators like [`slice::split`]. /// @@ -4555,7 +4555,7 @@ impl<T> [T] { /// assert_eq!(num, &1); /// assert_eq!(nums.element_offset(num), Some(2)); /// ``` - /// Returning `None` with an in-between element: + /// Returning `None` with an unaligned element: /// ``` /// #![feature(substr_range)] /// @@ -4594,7 +4594,8 @@ impl<T> [T] { /// Returns the range of indices that a subslice points to. /// - /// Returns `None` if `subslice` does not point within the slice or if it points between elements. + /// Returns `None` if `subslice` does not point within the slice or if it is not aligned with the + /// elements in the slice. /// /// This method **does not compare elements**. Instead, this method finds the location in the slice that /// `subslice` was obtained from. To find the index of a subslice via comparison, instead use |
