馃 #RustChallenge

What will be the result?

#rust #rustaceans #rustlang

@AstraKernel Compilation error due to missing function argument in the second call to print_info.
Why not support default parameters, such as Option type, which default to None 路 Issue #98090 路 rust-lang/rust

I am developing a library. When adding feature, it is inevitable to add parameters to functions or methods. However, this will lead to that the developers who used my library must make correspondin...

GitHub
@AstraKernel This won't compile, you need to supply both arguments in the 2nd `print_info` call.
Why not support default parameters, such as Option type, which default to None 路 Issue #98090 路 rust-lang/rust

I am developing a library. When adding feature, it is inevitable to add parameters to functions or methods. However, this will lead to that the developers who used my library must make correspondin...

GitHub

@AstraKernel a good way to setup default parameters in rust is by creating a params struct and impl default for it. Then call `..Default::default()` at the end of the params construction

https://stackoverflow.com/questions/19650265/is-there-a-faster-shorter-way-to-initialize-variables-in-a-rust-struct

Is there a faster/shorter way to initialize variables in a Rust struct?

In the following example, I would much prefer to assign a value to each field in the struct in the declaration of the fields. Alternatively, it effectively takes one additional statement for each f...

Stack Overflow
@AstraKernel solution??
i dont know
@mohammed
It will throw an error. Because the second print_info call missing one argument.
We have to call it like this:
print_info(2, None);