Avatar ·

Implementing default arguments for functions in Rust

Hello everyone! I'm new to Rust and came from Python and C++. These languages have a convenient feature for setting default argument values so you don't have to pass them every time. For example, in Python I could write: ```python def create_window(width=800, height=600, title="App"): pass ``` And call: `create_window(title="MyApp")`. In Rust I tried to do the same: ```rust fn create_window(width: u32 = 800, height: u32 = 600, title: &str = "App") { // ... } ``` But the compiler gives an error: "expected `:`, found `=`". I understand that Rust is stricter about signatures, but it seems to me that this is a very useful feature. How to properly implement "default argument" behavior in Rust? Do I need to write separate functions for each case? Or is there some idiomatic way?