Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

armanriazi•rust•error•E0308•mismatched types expected type parameter ``, found associated type

//Resolve IntoIterator<Item=S>
fn sum_list<I,S>(l:I,mut s:S)->S
    where I: IntoIterator,
          S: AddAssign,
{

    let mut it = l.into_iter();
    while let Some(n) = it.next(){
        s +=n //Error rised
    }
    s
}
 
PREVIOUS NEXT
Tagged: #types #expected #type #parameter #type
ADD COMMENT
Topic
Name
4+6 =