Done with 1.2.2 activities
This commit is contained in:
parent
da88fc810d
commit
de02f07049
@ -21,6 +21,18 @@ impl fmt::Display for Point2 {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Complex {
|
||||
real: f64,
|
||||
imag: f64,
|
||||
}
|
||||
|
||||
impl fmt::Display for Complex {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "real: {}, imag: {}", self.real, self.imag)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let minmax = MinMax(0, 14);
|
||||
|
||||
@ -40,4 +52,10 @@ fn main() {
|
||||
println!("Compare points:");
|
||||
println!("Display: {}", point);
|
||||
println!("Debug: {:?}", point);
|
||||
|
||||
let compl = Complex { real: 3.3, imag: 7.2 };
|
||||
|
||||
println!("Compare complex:");
|
||||
println!("Display: {}", compl);
|
||||
println!("Debug: {:?}", compl);
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
use std::fmt;
|
||||
|
||||
struct Structure(i32);
|
||||
|
||||
impl fmt::Display for Structure {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{}", self.0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user