File: struct.rs

package info (click to toggle)
rust-formatx 0.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 180 kB
  • sloc: makefile: 4
file content (21 lines) | stat: -rw-r--r-- 393 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use formatx::formatx;
use std::fmt::Display;

#[derive(Debug)]
struct Foo {
    _bar: String,
}

impl Display for Foo {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{:?}", self)
    }
}

fn main() {
    let foo = Foo {
        _bar: "foo-bar-struct".to_owned(),
    };

    println!("{}", formatx!("{:#?}", foo).unwrap());
}