|
@@ -144,7 +144,7 @@ impl OutputFormat {
|
|
true
|
|
true
|
|
}
|
|
}
|
|
|
|
|
|
- pub fn print_error(&self, error: TransportError) {
|
|
|
|
|
|
+ pub fn print_error(self, error: TransportError) {
|
|
match self {
|
|
match self {
|
|
Self::Short(..) | Self::Text(..) => {
|
|
Self::Short(..) | Self::Text(..) => {
|
|
eprintln!("Error [{}]: {}", erroneous_phase(&error), error_message(error));
|
|
eprintln!("Error [{}]: {}", erroneous_phase(&error), error_message(error));
|
|
@@ -270,7 +270,7 @@ impl TextFormat {
|
|
}
|
|
}
|
|
|
|
|
|
impl OutputFormat {
|
|
impl OutputFormat {
|
|
- fn json_queries(&self, queries: &[Query]) -> JsonValue {
|
|
|
|
|
|
+ fn json_queries(self, queries: &[Query]) -> JsonValue {
|
|
let queries = queries.iter().map(|q| {
|
|
let queries = queries.iter().map(|q| {
|
|
json!({
|
|
json!({
|
|
"name": q.qname,
|
|
"name": q.qname,
|
|
@@ -282,7 +282,7 @@ impl OutputFormat {
|
|
json!(queries)
|
|
json!(queries)
|
|
}
|
|
}
|
|
|
|
|
|
- fn json_answers(&self, answers: &[Answer]) -> JsonValue {
|
|
|
|
|
|
+ fn json_answers(self, answers: &[Answer]) -> JsonValue {
|
|
let answers = answers.iter().map(|a| {
|
|
let answers = answers.iter().map(|a| {
|
|
match a {
|
|
match a {
|
|
Answer::Standard { qname, qclass, ttl, record } => {
|
|
Answer::Standard { qname, qclass, ttl, record } => {
|
|
@@ -309,7 +309,7 @@ impl OutputFormat {
|
|
json!(answers)
|
|
json!(answers)
|
|
}
|
|
}
|
|
|
|
|
|
- fn json_record(&self, record: &Record) -> JsonValue {
|
|
|
|
|
|
+ fn json_record(self, record: &Record) -> JsonValue {
|
|
match record {
|
|
match record {
|
|
Record::A(rec) => json!({ "type": "A", "address": rec.address.to_string() }),
|
|
Record::A(rec) => json!({ "type": "A", "address": rec.address.to_string() }),
|
|
Record::AAAA(rec) => json!({ "type": "AAAA", "address": rec.address.to_string() }),
|
|
Record::AAAA(rec) => json!({ "type": "AAAA", "address": rec.address.to_string() }),
|