Compare commits
No commits in common. "20531d1154c887abfb2c7503e61c468578bc19eb" and "93860403c2276723c1ed208f60bd36aa8e3f2fac" have entirely different histories.
20531d1154
...
93860403c2
@ -1,5 +1,3 @@
|
||||
use std::fmt;
|
||||
|
||||
fn reverse(pair: (i32, bool)) -> (bool, i32) {
|
||||
let (integer, boolean) = pair;
|
||||
(boolean, integer)
|
||||
@ -8,16 +6,6 @@ fn reverse(pair: (i32, bool)) -> (bool, i32) {
|
||||
#[derive(Debug)]
|
||||
struct Matrix(f32, f32, f32, f32);
|
||||
|
||||
impl fmt::Display for Matrix {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "( {} {} )\n( {} {} )", self.0, self.1, self.2, self.3)
|
||||
}
|
||||
}
|
||||
|
||||
fn transpose(m: Matrix) -> Matrix {
|
||||
Matrix(m.0, m.2, m.1, m.3)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let long_tuple = (
|
||||
1u8, 2u16, 3u32, 4u64, -1i8, -2i16, -3i32, -4i64, 0.1f32, 0.2f64, 'a', true,
|
||||
@ -45,8 +33,4 @@ fn main() {
|
||||
|
||||
let matrix = Matrix(1.1, 1.2, 2.1, 2.2);
|
||||
println!("{:?}", matrix);
|
||||
println!("{}", matrix);
|
||||
|
||||
println!("Matrix:\n{}", matrix);
|
||||
println!("Transpose:\n{}", transpose(matrix));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user