Skip to main content
Post Closed as "Needs details or clarity" by gnat, Michael Kohne, user40980, user53019, Kilian Foth
deleted 3 characters in body
Source Link
gnat
  • 20.8k
  • 29
  • 115
  • 295

I'm trying to write a generic function summ in rust - but to no avail.Could Could someone please elucidate the problem?

fn summ<T:Add>(a:T,b:T)->T { a+b }

thanx

fn summ<T:Add>(a:T,b:T)->T  {
    a+b
} 

I'm trying to write a generic function summ in rust - but to no avail.Could someone please elucidate the problem?

fn summ<T:Add>(a:T,b:T)->T { a+b }

thanx

I'm trying to write a generic function summ in rust - but to no avail. Could someone please elucidate the problem?

fn summ<T:Add>(a:T,b:T)->T  {
    a+b
} 
Source Link
tyro1
  • 23
  • 1

problems compiling a function with a trait Add in Rust

I'm trying to write a generic function summ in rust - but to no avail.Could someone please elucidate the problem?

fn summ<T:Add>(a:T,b:T)->T { a+b }

thanx