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

Interface HasSquareRoot

Source Code/19-08.rs:7–9  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5*/
6fn main() {
7 trait HasSquareRoot { // trait declaration
8 fn sq_root(self) -> Self;
9 }
10 impl HasSquareRoot for f32 { // an implementation of the trait
11 fn sq_root(self) -> Self { self.sqrt() }
12 }

Callers

nothing calls this directly

Implementers 1

mainSource Code/19-08.rs

Calls

no outgoing calls

Tested by

no test coverage detected