15 lines
238 B
Rust
15 lines
238 B
Rust
|
use std::fmt;
|
||
|
|
||
|
struct Structure(i32);
|
||
|
|
||
|
impl fmt::Display for Structure {
|
||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||
|
write!(f, "{}", self.0)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
fn main() {
|
||
|
let s = Structure(4);
|
||
|
println!("s={}", s);
|
||
|
}
|