openethereum/util/https-fetch/examples/fetch.rs

16 lines
360 B
Rust
Raw Normal View History

2016-08-26 16:35:59 +02:00
extern crate https_fetch;
use std::io;
2016-08-31 13:24:06 +02:00
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
2016-08-26 16:35:59 +02:00
use https_fetch::*;
fn main() {
let client = Client::new().unwrap();
2016-08-31 13:24:06 +02:00
let aborted = Arc::new(AtomicBool::new(false));
2016-08-26 16:35:59 +02:00
2016-08-31 13:24:06 +02:00
client.fetch(Url::new("github.com", 443, "/").unwrap(), Box::new(io::stdout()), aborted, |result| {
2016-08-31 10:43:55 +02:00
assert!(result.is_ok());
}).unwrap();
2016-08-26 16:35:59 +02:00
}