Answers for "rust•armanazi•error•[E0507]: cannot move out of `self.step` which is behind a mutable reference self.curr += self.step;"

0

rust•armanazi•error•[E0507]: cannot move out of `self.step` which is behind a mutable reference self.curr += self.step;

//Add "Copy +" to follow where:
impl<T> Iterator for Stepper<T>
    where T:AddAssign  + PartialOrd
{
    type Item=T;

    fn next(&mut self)->Option<T>{
        if self.curr >= self.stop {
            return None;
        }
        let res = self.curr;//[E0507]
        self.curr += self.step; 
        Some(res)
    }
}
Posted by: Guest on March-17-2022

Code answers related to "rust•armanazi•error•[E0507]: cannot move out of `self.step` which is behind a mutable reference self.curr += self.step;"

Browse Popular Code Answers by Language