about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-05-06 16:28:41 +1000
committerGitHub <noreply@github.com>2025-05-06 16:28:41 +1000
commit6238555e72b2a794c277f0a95be269aca49da093 (patch)
tree1645adda7372c959dfa33c16732c0bfc03823c84
parent7ea335090202b4ccf634923f25b2a90072a08cbf (diff)
parent415a73e3eb4910bc40eaec8022e7bf8813523318 (diff)
downloadrust-6238555e72b2a794c277f0a95be269aca49da093.tar.gz
rust-6238555e72b2a794c277f0a95be269aca49da093.zip
Rollup merge of #140598 - ShE3py:iter-misc-docs, r=workingjubilee
Steer docs to `utf8_chunks` and `Iterator::take`

- Adds `limit` as an alias of `take` (as this is [what Java calls this operation](https://docs.oracle.com/javase/8/docs/api/java/util/stream/Stream.html#limit-long-));
- Says that [`Utf8Chunks`](https://doc.rust-lang.org/std/str/struct.Utf8Chunks.html) comes from [`[u8]::utf8_chunks`](https://doc.rust-lang.org/std/primitive.slice.html#method.utf8_chunks).

``@rustbot`` label +A-docs
-rw-r--r--library/core/src/iter/traits/iterator.rs1
-rw-r--r--library/core/src/str/lossy.rs2
2 files changed, 3 insertions, 0 deletions
diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs
index c68fd2115d6..0d7d7860b03 100644
--- a/library/core/src/iter/traits/iterator.rs
+++ b/library/core/src/iter/traits/iterator.rs
@@ -1358,6 +1358,7 @@ pub trait Iterator {
     /// ```
     ///
     /// [`by_ref`]: Iterator::by_ref
+    #[doc(alias = "limit")]
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]
     fn take(self, n: usize) -> Take<Self>
diff --git a/library/core/src/str/lossy.rs b/library/core/src/str/lossy.rs
index ed2cefc59a5..8d4210c8082 100644
--- a/library/core/src/str/lossy.rs
+++ b/library/core/src/str/lossy.rs
@@ -147,12 +147,14 @@ impl fmt::Debug for Debug<'_> {
 /// An iterator used to decode a slice of mostly UTF-8 bytes to string slices
 /// ([`&str`]) and byte slices ([`&[u8]`][byteslice]).
 ///
+/// This struct is created by the [`utf8_chunks`] method on bytes slices.
 /// If you want a simple conversion from UTF-8 byte slices to string slices,
 /// [`from_utf8`] is easier to use.
 ///
 /// See the [`Utf8Chunk`] type for documentation of the items yielded by this iterator.
 ///
 /// [byteslice]: slice
+/// [`utf8_chunks`]: slice::utf8_chunks
 /// [`from_utf8`]: super::from_utf8
 ///
 /// # Examples