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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#![crate_name = "consul"]
#![crate_type = "lib"]
#[doc(no_inline)]
extern crate curl;
extern crate rustc_serialize;
pub use agent::{Agent, AgentMember};
pub use catalog::Catalog;
pub use health::Health;
pub use client::Client;
pub use keystore::Keystore;
pub use session::Session;
pub use structs::{Node, Service, HealthService, RegisterService, TtlHealthCheck};
mod agent;
mod catalog;
mod structs;
mod health;
mod client;
mod session;
mod keystore;
use rustc_serialize::json;
#[inline]
pub fn get_string(json_data: &json::Json, path: &[&str]) -> Option<String> {
let value = match json_data.find_path(path) {
Some(value) => value,
None => return None
};
let s_value = match value.as_string() {
Some(value) => value,
None => return None
};
Some(s_value.to_owned())
}