How do I use parameter overloading or optional parameters in rust?
问题 I am trying to write a print function for a binary tree and here is what I have so far: impl TreeNode { fn print(&self) { self.print(0); } fn print(&self, level: u8) { for _i in range(0,level) { print!("\t"); } match self.data { Some(x) => println!("{}",x), None => () }; match self.left { Some(ref x) => x.print(level+1), None => () }; match self.right { Some(ref x) => x.print(level+1), None => () }; } } I am getting the error: duplicate definition of value print . So I was wondering if there