Guest User

Untitled

a guest
May 27th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. struct Array {
  2. inner: [bool; 10000]
  3. }
  4. impl Array {
  5. fn zero() -> Self {
  6. Array {
  7. inner: [false; 10000]
  8. }
  9. }
  10. fn true_iter<'a>(&'a self) -> impl 'a + Iterator<Item = usize> {
  11. (0..1000).filter(|&i| self.inner[i])
  12. }
  13. }
  14.  
  15.  
  16. fn main() {
  17. let mut a = Array::zero();
  18. for i in 0..10000 {
  19. if i % 1378 == 0 {
  20. a.inner[i] = true;
  21. }
  22. }
  23. for i in a.true_iter() {
  24. println!("{}", i)
  25. }
  26. }
Add Comment
Please, Sign In to add comment