MCPcopy Create free account
hub / github.com/derekbanas/Rust-Tutorial / get_sum_gen

Function get_sum_gen

main.rs:157–159  ·  view source on GitHub ↗

We get 2 generic types of the same type and return that same type

(x: T, y: T)

Source from the content-addressed store, hash-verified

155
156// We get 2 generic types of the same type and return that same type
157fn get_sum_gen<T:Add<Output = T>>(x: T, y: T) -> T {
158 return x + y;
159}
160
161fn main() {
162 // It is common to indent with 4 spaces

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected