| 1 |
use std::any::TypeId; |
| 2 |
|
| 3 |
use crate::response::rir_search::{AutnumSearchResults, IpSearchResults}; |
| 4 |
use crate::response::search::{DomainSearchResults, EntitySearchResults, NameserverSearchResults}; |
| 5 |
|
| 6 |
use super::{CheckParams, Checks, GetChecks, GetGroupChecks}; |
| 7 |
|
| 8 |
impl GetChecks for DomainSearchResults { |
| 9 |
fn get_checks(&self, index: Option<usize>, params: CheckParams) -> super::Checks { |
| 10 |
let sub_checks: Vec<Checks> = { |
| 11 |
let mut sub_checks = self |
| 12 |
.common |
| 13 |
.get_group_checks(params.from_parent(TypeId::of::<Self>())); |
| 14 |
self.results.iter().enumerate().for_each(|(i, result)| { |
| 15 |
sub_checks |
| 16 |
.push(result.get_checks(Some(i), params.from_parent(TypeId::of::<Self>()))) |
| 17 |
}); |
| 18 |
sub_checks |
| 19 |
}; |
| 20 |
Checks { |
| 21 |
rdap_struct: super::RdapStructure::DomainSearchResults, |
| 22 |
index, |
| 23 |
items: vec![], |
| 24 |
sub_checks, |
| 25 |
} |
| 26 |
} |
| 27 |
} |
| 28 |
|
| 29 |
impl GetChecks for NameserverSearchResults { |
| 30 |
fn get_checks(&self, index: Option<usize>, params: CheckParams) -> super::Checks { |
| 31 |
let sub_checks: Vec<Checks> = { |
| 32 |
let mut sub_checks: Vec<Checks> = self |
| 33 |
.common |
| 34 |
.get_group_checks(params.from_parent(TypeId::of::<Self>())); |
| 35 |
self.results.iter().enumerate().for_each(|(i, result)| { |
| 36 |
sub_checks |
| 37 |
.push(result.get_checks(Some(i), params.from_parent(TypeId::of::<Self>()))) |
| 38 |
}); |
| 39 |
sub_checks |
| 40 |
}; |
| 41 |
Checks { |
| 42 |
rdap_struct: super::RdapStructure::NameserverSearchResults, |
| 43 |
index, |
| 44 |
items: vec![], |
| 45 |
sub_checks, |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
impl GetChecks for EntitySearchResults { |
| 51 |
fn get_checks(&self, index: Option<usize>, params: CheckParams) -> super::Checks { |
| 52 |
let sub_checks: Vec<Checks> = { |
| 53 |
let mut sub_checks: Vec<Checks> = self |
| 54 |
.common |
| 55 |
.get_group_checks(params.from_parent(TypeId::of::<Self>())); |
| 56 |
self.results.iter().enumerate().for_each(|(i, result)| { |
| 57 |
sub_checks |
| 58 |
.push(result.get_checks(Some(i), params.from_parent(TypeId::of::<Self>()))) |
| 59 |
}); |
| 60 |
sub_checks |
| 61 |
}; |
| 62 |
Checks { |
| 63 |
rdap_struct: super::RdapStructure::EntitySearchResults, |
| 64 |
index, |
| 65 |
items: vec![], |
| 66 |
sub_checks, |
| 67 |
} |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
impl GetChecks for IpSearchResults { |
| 72 |
fn get_checks(&self, index: Option<usize>, params: CheckParams) -> super::Checks { |
| 73 |
let sub_checks: Vec<Checks> = { |
| 74 |
let mut sub_checks: Vec<Checks> = self |
| 75 |
.common |
| 76 |
.get_group_checks(params.from_parent(TypeId::of::<Self>())); |
| 77 |
self.results.iter().enumerate().for_each(|(i, result)| { |
| 78 |
sub_checks |
| 79 |
.push(result.get_checks(Some(i), params.from_parent(TypeId::of::<Self>()))) |
| 80 |
}); |
| 81 |
sub_checks |
| 82 |
}; |
| 83 |
Checks { |
| 84 |
rdap_struct: super::RdapStructure::IpSearchResults, |
| 85 |
index, |
| 86 |
items: vec![], |
| 87 |
sub_checks, |
| 88 |
} |
| 89 |
} |
| 90 |
} |
| 91 |
|
| 92 |
impl GetChecks for AutnumSearchResults { |
| 93 |
fn get_checks(&self, index: Option<usize>, params: CheckParams) -> super::Checks { |
| 94 |
let sub_checks: Vec<Checks> = { |
| 95 |
let mut sub_checks: Vec<Checks> = self |
| 96 |
.common |
| 97 |
.get_group_checks(params.from_parent(TypeId::of::<Self>())); |
| 98 |
self.results.iter().enumerate().for_each(|(i, result)| { |
| 99 |
sub_checks |
| 100 |
.push(result.get_checks(Some(i), params.from_parent(TypeId::of::<Self>()))) |
| 101 |
}); |
| 102 |
sub_checks |
| 103 |
}; |
| 104 |
Checks { |
| 105 |
rdap_struct: super::RdapStructure::AutnumSearchResults, |
| 106 |
index, |
| 107 |
items: vec![], |
| 108 |
sub_checks, |
| 109 |
} |
| 110 |
} |
| 111 |
} |