Compare commits
No commits in common. "82ed5d328d27d8da12730ed428844ed72d9f1924" and "8d0699fb7aa6975b3ecbd6ad5aa6f522e3f98f9f" have entirely different histories.
82ed5d328d
...
8d0699fb7a
@ -21,18 +21,6 @@ impl fmt::Display for Point2D {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Complex {
|
||||
real: f64,
|
||||
imag: f64,
|
||||
}
|
||||
|
||||
impl fmt::Display for Complex {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "{} + {}i", self.real, self.imag)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let minmax = MinMax(0, 14);
|
||||
|
||||
@ -54,13 +42,4 @@ fn main() {
|
||||
println!("Compare points:");
|
||||
println!("Display: {}", point);
|
||||
println!("Debug: {:?}", point);
|
||||
|
||||
let cmplx = Complex {
|
||||
real: 3.3,
|
||||
imag: 7.2,
|
||||
};
|
||||
|
||||
println!("Compare complexes:");
|
||||
println!("Display: {}", cmplx);
|
||||
println!("Debug: {:?}", cmplx);
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
use std::fmt;
|
||||
|
||||
struct List(Vec<i32>);
|
||||
|
||||
impl fmt::Display for List {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let vec = &self.0;
|
||||
|
||||
write!(f, "[")?;
|
||||
|
||||
for (count, v) in vec.iter().enumerate() {
|
||||
if count != 0 {
|
||||
write!(f, ", ")?;
|
||||
}
|
||||
write!(f, "{}: {}", count, v)?;
|
||||
}
|
||||
|
||||
write!(f, "]")
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let v = List(vec![1, 2, 3]);
|
||||
println!("{}", v);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user