using rust default value
Rust Default::default is really useful to place default value to a structure or pass it into a function. Example below shows how we use the .. operator to assigned default value to more than one fields, when we instantiate the struct / type Point. #[derive( Debug , Default )] struct Point { x : i32 , y : i32 , a : i32 , isOk : bool } fn main () { let s = Point { isOk : true , .. Default :: default () }; println! ( "{:?}" , s ); } You can also use that to pass function - for example and it prints out 0 as the total. fn print_value ( total : u32 ) { print! ( "{}" , total ); } fn main () { print_value ( Default :: default ()) }