Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•error•[E0369]: binary operation `>=` cannot be applied to type `T`

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

    fn next(&mut self)->Option<T>{
        if self.curr >= self.stop //[E0369]{
            return None;
        }
        let res = self.curr;
        self.curr += self.step;
        Some(res)
    }
}

//e.g:
impl <T:PartialOrd> Tree<T>{
    pub fn add(&mut self,t:T) {
        match self{
            LeafTail => {
                *self = Tree::new(t);
            },
            Head(d,lt,rt)=>{
                if t < *d {
                    lt.add(t);
                }else {
                    rt.add(t);
                }
            }
        }
    }
    pub fn LeafTail()->Self{
        LeafTail
    }

    pub fn new(t:T)->Self{
        Head(t,Box::new(LeafTail),Box::new(LeafTail))
    }

}
 
PREVIOUS NEXT
Tagged: #binary #operation #applied #type
ADD COMMENT
Topic
Name
4+8 =