about summary refs log tree commit diff
path: root/tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
diff options
context:
space:
mode:
authorDiego Ongaro <ongardie@gmail.com>2025-04-13 19:52:34 -0700
committerDiego Ongaro <ongardie@gmail.com>2025-04-13 19:52:34 -0700
commite5fb426a833e45565f13f81c2c664e77e0e351f1 (patch)
tree81d1f9be2e40e2721def295356122538012424e1 /tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs
parent6e830462330a9e34d8176e86d4580dd0820c6fd5 (diff)
downloadrust-e5fb426a833e45565f13f81c2c664e77e0e351f1.tar.gz
rust-e5fb426a833e45565f13f81c2c664e77e0e351f1.zip
docs: Add example to `Iterator::take` with `by_ref`
If you want to logically split an iterator after `n` items, you might first
discover `take`. Before this change, you'd find that `take` consumes the
iterator, and you'd probably be stuck. The answer involves `by_ref`, but that's
hard to discover, especially since `by_ref` is a bit abstract and `Iterator`
has many methods.

After this change, you'd see the example showing `take` along with `by_ref`,
which allows you to continue using the rest of the iterator. `by_ref` had a
good example involving `take` already, so this change just duplicates that
existing example under `take`.
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions