-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
one of your examples doesnt work #526
Comments
The closure passed to use curl::easy::Easy;
// Capture output into a local `Vec`.
fn main() {
let mut dst = Vec::new();
let mut easy = Easy::new();
easy.url("https://www.rust-lang.org/").unwrap();
{
let mut transfer = easy.transfer();
transfer.write_function(|data| {
dst.extend_from_slice(data);
Ok(data.len())
}).unwrap();
transfer.perform().unwrap();
}
println!("{:?}", dst);
} or more explicitly like this: use curl::easy::Easy;
// Capture output into a local `Vec`.
fn main() {
let mut dst = Vec::new();
let mut easy = Easy::new();
easy.url("https://www.rust-lang.org/").unwrap();
let mut transfer = easy.transfer();
transfer.write_function(|data| {
dst.extend_from_slice(data);
Ok(data.len())
}).unwrap();
transfer.perform().unwrap();
drop(transfer);
println!("{:?}", dst);
} Hope that helps! |
i already tried that and it didnt work, maybe i missed something but ive already moved the project to a shell script and its 90% done |
Best to Use Easy2. |
ive added that last println! line as a basic way to show theres no way to access the data after its written to, unless im missing something fundamental about closures
The text was updated successfully, but these errors were encountered: