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

Function quartic_root

Source Code/19-07.rs:18–21  ·  view source on GitHub ↗

function that depends on the Number parameter, that must implement the HasSquareRoot trait

(x: Number)

Source from the content-addressed store, hash-verified

16 // function that depends on the Number parameter,
17 // that must implement the HasSquareRoot trait
18 fn quartic_root<Number>(x: Number) -> Number
19 where Number: HasSquareRoot {
20 x.sq_root().sq_root()
21 }
22 // Here that function if instantiated twice, in both cases
23 // using types that implement the HasSquareRoot trait
24 print!("{} {}",

Callers

nothing calls this directly

Calls 1

sq_rootMethod · 0.45

Tested by

no test coverage detected