stride.rs
Rust calls mem::transmute
SHA-2566b6258a676416b1eefb8328268145c80e79290a4fd555fb22e010e49d160a78e
MaleculeH(Db)
Evidence
1//! Licensed under the Apache License, Version 2.0
2//! http://www.apache.org/licenses/LICENSE-2.0 or the MIT license
3/ …
3:13… pensource.org/licenses/MIT, at your
4//! option. This file may not be copied, modified, or distributed
5//! except according to those terms.
6
7use std::fmt;
8use std::marker;
9use std::mem;
10use std::ops::{Index, IndexMut};
11
12use misc::Slice;
13
14/// An iterator similar to the slice iterator, but with a certain number of steps
15/// (the stride) skipped per iteration.
16///
17/// `Stride` does not support zero-sized types for `A`.
18///
19/// Iterator element type is `&'a A`.
20pub struct Stride<'a, A: 'a> {
21 /// base poin …
90:5… /// Create Stride iterator from a slice and the element step count.
91 ///
92 /// If `step` is negative, start from the b …
184:11… let elt: $elem =
185 mem::transmute(self.begin.offset(self.offset));
186 self.offset += self.stride;
187 Some(elt)
188 …