Matlab, Rust.
Image by Midjourney. Let’s add a struct into our library. Add the following into src/lib.rs: pub struct Point { pub x: f64, pub y: f64, } impl Point { pub fn distance_to(&self, p2: &Point) -> f64 { let dx = (p2.x - self.x).abs(); let dy = (p2.y - self.y).abs(); (dx * dx + dy * dy).sqrt() } } This