How to resolve ambiguous associated type with NetRc
Solution 1:
In this case the error seems misleading.
From the documentation, NetRc
emun lives under the curl::easy
module, not part of the Easy
struct.
Just bring it to scope as you did with Easy
itself:
use curl::easy::{Easy, NetRc};
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(NetRc::Optional)?;
// Main activity goes here
Ok(())
}
Or use the full path:
easy.netrc(curl::easy::NetRc::Optional)?;