Answers for "rust•armanazi•error•[E0368]: binary assignment operation `+=` cannot be applied to type `T`"

0

rust•armanazi•error•[E0368]: binary assignment operation `+=` cannot be applied to type `T`

use std::ops::AddAssign;

//Add "AddAssign +" to follow where:

impl<T> Iterator for Stepper<T>
    where T:  Copy + PartialOrd
{
    type Item=T;

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

Code answers related to "rust•armanazi•error•[E0368]: binary assignment operation `+=` cannot be applied to type `T`"

Browse Popular Code Answers by Language