Question : rust implement debug for struct
Answered by : zwazel
struct Point { x: i32, y: i32,
}
impl fmt::Debug for Point { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Point") .field("x", &self.x) .field("y", &self.y) .finish() }
}
Source : https://doc.rust-lang.org/std/fmt/trait.Debug.html | Last Update : Mon, 04 Apr 22