I'm trying to implement a function with optional arguments:
fn optional_args<S>(arg0: impl Into<Option<S>>)
where
S: AsRef<str>,
{
unimplemented!()
}
But I can't call the function with None
argument:
fn main() {
optional_args::<String>(None::<String>);
}
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> src/main.rs:2:21
|
2 | optional_args::<String>(None::<String>);
| ^^^^^^ explicit generic argument not allowed
What am I doing wrong?