Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Array {
- inner: [bool; 10000]
- }
- impl Array {
- fn zero() -> Self {
- Array {
- inner: [false; 10000]
- }
- }
- fn true_iter<'a>(&'a self) -> impl 'a + Iterator<Item = usize> {
- (0..1000).filter(|&i| self.inner[i])
- }
- }
- fn main() {
- let mut a = Array::zero();
- for i in 0..10000 {
- if i % 1378 == 0 {
- a.inner[i] = true;
- }
- }
- for i in a.true_iter() {
- println!("{}", i)
- }
- }
Add Comment
Please, Sign In to add comment