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

0

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
}
Posted by: Guest on May-07-2022

Code answers related to "armanriazi•rust•error•E0308•mismatched types expected type parameter ``, found associated type"

Browse Popular Code Answers by Language