Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•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)
    }
}
 
PREVIOUS NEXT
Tagged: #binary #assignment #operation #applied #type
ADD COMMENT
Topic
Name
8+3 =