Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fmt;
- #[derive(Debug)]
- 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)
- }
- }
- fn main() {
- let origin = Point { x: 0, y: 0 };
- println!("Display : {} \n---", origin);
- println!("Debug : {:?} \n---", origin);
- println!("Debug Extd.: {:#?} \n---", origin);
- }
Add Comment
Please, Sign In to add comment