Skip to content

Commit 1480eb9

Browse files
committed
Adds info about (lack of) object safety to iter module documentation.
(c.f. rayon-rs#628)
1 parent fc69e50 commit 1480eb9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/iter/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@
7272
//! to mirror the unstable `std::ops::Try` with implementations for `Option` and
7373
//! `Result`, where `Some`/`Ok` values will let those iterators continue, but
7474
//! `None`/`Err` values will exit early.
75+
//!
76+
//! A note about object safety: It is currently _not_ possible to wrap
77+
//! a ParallelIterator (or any trait that depends on it) using a
78+
//! `Box<dyn ParallelIterator>` or other kind of dynamic allocation,
79+
//! because `ParallelIterator` is **not object-safe**.
80+
//! (This keeps the implementation simpler and allows extra optimizations.)
7581
7682
use self::plumbing::*;
7783
use self::private::Try;

0 commit comments

Comments
 (0)