Answers for "rust lang display"

0

rust lang display

se std::fmt;

struct Point {
    x: i32,
    y: i32,
}

impl fmt::Display for Point {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "({}, {})", self.x, self.y)
    }
}
Posted by: Guest on May-10-2021

Browse Popular Code Answers by Language