I'm trying to make curl-rust optionally make use of a ~/.netrc file, but I cannot make it compile:
use curl::easy::Easy;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let urlstring = "https://example.com/";
let mut easy = Easy::new();
// Setting some curl options
easy.url(urlstring)?;
easy.fail_on_error(true)?;
easy.netrc(Easy::NetRc::Optional)?;
// Main activity goes here
Ok(())
}
When building, I keep getting the following error:
error[E0223]: ambiguous associated type
--> src/main.rs:11:16
|
11 | easy.netrc(Easy::NetRc::Optional)?;
| ^^^^^^^^^^^ help: use fully-qualified syntax: `<Easy as Trait>::NetRc`
For more information about this error, try `rustc --explain E0223`.
What am I doing wrong?