MCPcopy Create free account
hub / github.com/Apress/beginning-rust-2e / add_complex

Function add_complex

Source Code/20-05.rs:8–10  ·  view source on GitHub ↗
(lhs: Complex, rhs: Complex)

Source from the content-addressed store, hash-verified

6 im: f64,
7 }
8 fn add_complex(lhs: Complex, rhs: Complex) -> Complex {
9 Complex { re: lhs.re + rhs.re, im: lhs.im + rhs.im }
10 }
11 let z1 = Complex { re: 3.8, im: -2.1 };
12 let z2 = Complex { re: -1.5, im: 8.6 };
13 let z3 = add_complex(z1, z2);

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected