/* * Rust does not really have a default concept of equivalence between structs * Instead like java, programmer is required to implement a method * * type aliases (like money below) look like structural equivalence, * but are certainly not * * ggtowell * Nov 2023 */ type Money = f32; #[derive(Debug)] struct SsOne { a: i32 } #[derive(Debug)] struct SsTwo { a: i32 } type SsThree = SsTwo; fn main() { println!("Hello, world!"); let cash : Money = 5.0; let five : f32 = 5.0; println!("{}", cash==five); let ss = SsOne{a:5}; println!("{:?}", ss); let st = SsTwo{a:5}; //println!("{}", ss == st); // curious that rust-analyzer does not flag this! let s3 = SsThree{a:17}; println!("{:?}", s3); }