Run `cargo fmt`
This commit is contained in:
parent
c837a13121
commit
d5c98510db
|
@ -8,7 +8,7 @@ pub struct ResourceRequest {
|
||||||
resource_types: Vec<String>,
|
resource_types: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize,PartialEq,Debug)]
|
#[derive(Deserialize, PartialEq, Debug)]
|
||||||
pub struct Resource {
|
pub struct Resource {
|
||||||
r#type: String,
|
r#type: String,
|
||||||
blocked_in: HashMap<String, bool>,
|
blocked_in: HashMap<String, bool>,
|
||||||
|
@ -16,18 +16,18 @@ pub struct Resource {
|
||||||
address: String,
|
address: String,
|
||||||
port: u16,
|
port: u16,
|
||||||
fingerprint: String,
|
fingerprint: String,
|
||||||
#[serde(rename="or-addresses")]
|
#[serde(rename = "or-addresses")]
|
||||||
or_addresses: Option<Vec<String>>,
|
or_addresses: Option<Vec<String>>,
|
||||||
distribution: String,
|
distribution: String,
|
||||||
flags: Option<HashMap<String,bool>>,
|
flags: Option<HashMap<String, bool>>,
|
||||||
params: Option<HashMap<String,String>>,
|
params: Option<HashMap<String, String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct ResourceDiff {
|
pub struct ResourceDiff {
|
||||||
new: Option<HashMap<String,Vec<Resource>>>,
|
new: Option<HashMap<String, Vec<Resource>>>,
|
||||||
changed: Option<HashMap<String,Vec<Resource>>>,
|
changed: Option<HashMap<String, Vec<Resource>>>,
|
||||||
gone: Option<HashMap<String,Vec<Resource>>>,
|
gone: Option<HashMap<String, Vec<Resource>>>,
|
||||||
full_update: bool,
|
full_update: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,10 @@ mod tests {
|
||||||
resource_types: vec![String::from("obfs2"), String::from("scramblesuit")],
|
resource_types: vec![String::from("obfs2"), String::from("scramblesuit")],
|
||||||
};
|
};
|
||||||
let json = serde_json::to_string(&req).unwrap();
|
let json = serde_json::to_string(&req).unwrap();
|
||||||
assert_eq!(json, "{\"request_origin\":\"https\",\"resource_types\":[\"obfs2\",\"scramblesuit\"]}")
|
assert_eq!(
|
||||||
|
json,
|
||||||
|
"{\"request_origin\":\"https\",\"resource_types\":[\"obfs2\",\"scramblesuit\"]}"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -51,7 +54,10 @@ mod tests {
|
||||||
flags.insert(String::from("fast"), true);
|
flags.insert(String::from("fast"), true);
|
||||||
flags.insert(String::from("stable"), true);
|
flags.insert(String::from("stable"), true);
|
||||||
let mut params = HashMap::new();
|
let mut params = HashMap::new();
|
||||||
params.insert(String::from("password"), String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"));
|
params.insert(
|
||||||
|
String::from("password"),
|
||||||
|
String::from("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),
|
||||||
|
);
|
||||||
let bridge = Resource {
|
let bridge = Resource {
|
||||||
r#type: String::from("scramblesuit"),
|
r#type: String::from("scramblesuit"),
|
||||||
blocked_in: HashMap::new(),
|
blocked_in: HashMap::new(),
|
||||||
|
|
Loading…
Reference in New Issue