1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
use std::time::Duration;
use hyper::Client as HyperClient;
use super::{Client, FRACTAL_SERVER, FRACTAL_DEV_SERVER};
impl Client {
pub fn new() -> Client {
Client {
client: HyperClient::new(),
url: format!("{}v1/", FRACTAL_SERVER),
}
}
pub fn new_with_url<S: AsRef<str>>(url: S) -> Client {
Client {
client: HyperClient::new(),
url: format!("{}v1/", url.as_ref()),
}
}
pub fn new_dev() -> Client {
Client {
client: HyperClient::new(),
url: format!("{}v1/", FRACTAL_DEV_SERVER),
}
}
pub fn set_read_timeout(&mut self, timeout: Option<Duration>) {
self.client.set_read_timeout(timeout);
}
pub fn set_write_timeout(&mut self, timeout: Option<Duration>) {
self.client.set_write_timeout(timeout);
}
}