You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
238 B
15 lines
238 B
4 years ago
|
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);
|
||
|
}
|