aboutsummaryrefslogtreecommitdiff
path: root/src/response
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2022-10-24 21:52:30 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2022-10-24 21:52:30 +0200
commita607f4bcab2e846cb2b91761be808eb516d03d8f (patch)
treee8586e6a02ffdf09d7e38fbd2bcc789444c70d20 /src/response
parent0acc44b468a6c244620efee7470fc24d6971e085 (diff)
get rid of some of the static lifetimes
Diffstat (limited to 'src/response')
-rw-r--r--src/response/nameserver.rs42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/response/nameserver.rs b/src/response/nameserver.rs
index 24e341e..6ac330b 100644
--- a/src/response/nameserver.rs
+++ b/src/response/nameserver.rs
@@ -27,26 +27,26 @@ impl TryFrom<xmlrpc::Value> for Record {
fn try_from(v: xmlrpc::Value) -> Result<Self> {
if let xmlrpc::Value::Struct(map) = v {
let record = Self {
- id: get_i32(&map, "id")?,
- name: get_str(&map, "name")?,
- record_type: get_str(&map, "type")?.try_into()?,
- content: get_str(&map, "content")?,
- ttl: get_i32(&map, "ttl")?,
- priority: get_i32(&map, "prio")?,
- url_rdr_type: match get_str(&map, "urlRedirectType").ok() {
+ id: get_i32(&map, "id".into())?,
+ name: get_str(&map, "name".into())?,
+ record_type: get_str(&map, "type".into())?.try_into()?,
+ content: get_str(&map, "content".into())?,
+ ttl: get_i32(&map, "ttl".into())?,
+ priority: get_i32(&map, "prio".into())?,
+ url_rdr_type: match get_str(&map, "urlRedirectType".into()).ok() {
Some(url_rdr_type) => url_rdr_type.try_into().ok(),
None => None,
},
- url_rdr_title: get_str(&map, "urlRedirectTitle").ok(),
- url_rdr_desc: get_str(&map, "urlRedirectDescription").ok(),
- url_rdr_keywords: get_str(&map, "urlRedirectKeywords").ok(),
- url_rdr_favicon: get_str(&map, "urlRedirectFavIcon").ok(),
- url_append: get_bool(&map, "urlAppend").ok(),
+ url_rdr_title: get_str(&map, "urlRedirectTitle".into()).ok(),
+ url_rdr_desc: get_str(&map, "urlRedirectDescription".into()).ok(),
+ url_rdr_keywords: get_str(&map, "urlRedirectKeywords".into()).ok(),
+ url_rdr_favicon: get_str(&map, "urlRedirectFavIcon".into()).ok(),
+ url_append: get_bool(&map, "urlAppend".into()).ok(),
};
Ok(record)
} else {
- Err(Error::Type("record", "Struct", v))
+ Err(Error::Type("record".into(), "Struct".into(), v))
}
}
}
@@ -68,20 +68,20 @@ impl TryFrom<Response> for RecordInfo {
type Error = Error;
fn try_from(resp: Response) -> Result<Self> {
let info = Self {
- domain_id: get_i32(&resp.data, "roId").ok(),
- domain_name: get_str(&resp.data, "domain").ok(),
- domain_type: match get_str(&resp.data, "type").ok() {
+ domain_id: get_i32(&resp.data, "roId".into()).ok(),
+ domain_name: get_str(&resp.data, "domain".into()).ok(),
+ domain_type: match get_str(&resp.data, "type".into()).ok() {
Some(domain_type) => domain_type.try_into().ok(),
None => None,
},
- master_address: get_str(&resp.data, "masterIp").ok(),
- last_zone_check: get_datetime(&resp.data, "lastZoneCheck").ok(),
- slave_dns: match get_map(&resp.data, "slaveDns").ok() {
+ master_address: get_str(&resp.data, "masterIp".into()).ok(),
+ last_zone_check: { get_datetime(&resp.data, "lastZoneCheck".into()).ok() },
+ slave_dns: match get_map(&resp.data, "slaveDns".into()).ok() {
Some(slave_dns) => slave_dns.try_into().ok(),
None => None,
},
- soa_serial: get_str(&resp.data, "SOAserial").ok(),
- records: match get_array(&resp.data, "record").ok() {
+ soa_serial: get_str(&resp.data, "SOAserial".into()).ok(),
+ records: match get_array(&resp.data, "record".into()).ok() {
Some(records) => Some(
records
.iter()