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

Function quartic_root

Source Code/19-06.rs:15–18  ·  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

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

Callers

nothing calls this directly

Calls 1

sq_rootMethod · 0.45

Tested by

no test coverage detected