I'm getting this error when I'm trying to pass a variable of type String to Command:: new
let output = Command::new(editor.as_ref() | -------^^^^^^-- | | | | | cannot infer type for type parameter `T` declared on the trait `AsRef` | this method call resolves to `&T` | = note: type must be known at this point
Couple of questions:
- How I am supposed to specify the type?
- Why is the type of String not inferred (as editor is of type String) and just passed as ref to the Command:: new ?
- Why is this type not inferred from the type of argument required for the Command:: new ?