]> git.lizzy.rs Git - rust.git/blob - src/libcore/iter_private.rs
Auto merge of #56462 - Zoxc:query-macro, r=oli-obk
[rust.git] / src / libcore / iter_private.rs
1 /// An iterator whose items are random accessible efficiently
2 ///
3 /// # Safety
4 ///
5 /// The iterator's .len() and size_hint() must be exact.
6 /// `.len()` must be cheap to call.
7 ///
8 /// .get_unchecked() must return distinct mutable references for distinct
9 /// indices (if applicable), and must return a valid reference if index is in
10 /// 0..self.len().
11 #[doc(hidden)]
12 pub unsafe trait TrustedRandomAccess : ExactSizeIterator {
13     unsafe fn get_unchecked(&mut self, i: usize) -> Self::Item;
14     /// Returns `true` if getting an iterator element may have
15     /// side effects. Remember to take inner iterators into account.
16     fn may_have_side_effect() -> bool;
17 }