MCPcopy Create free account
hub / github.com/CSpyridakis/notes / area

Method area

Rust/notes.rs:1684–1692  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

1682 // caller object. In this case `Self` = `Rectangle`
1683 #[allow(dead_code)]
1684 fn area(&self) -> f64 {
1685 // `self` gives access to the struct fields via the dot operator
1686 let Point { x: x1, y: y1 } = self.p1;
1687 let Point { x: x2, y: y2 } = self.p2;
1688
1689 // `abs` is a `f64` method that returns the absolute value of the
1690 // caller
1691 ((x1 - x2) * (y1 - y2)).abs()
1692 }
1693
1694 #[allow(dead_code)]
1695 fn perimeter(&self) -> f64 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected