Relative Content

Tag Archive for rust

How to do priori calculations for rust iterators only once

I have a struct, an iterator, and a function that the iterator uses. In the iterator code I have a variable n2 that is calculated each time. This seems unnecessary, n2 only needs to be calculated once, not on each iteration, how do I optimize the code?