diff --git a/src/ipinfo.rs b/src/ipinfo.rs index bc2d706..14ec50c 100644 --- a/src/ipinfo.rs +++ b/src/ipinfo.rs @@ -182,7 +182,8 @@ impl IpInfo { ips: &[&str], batch_config: BatchReqOpts, ) -> Result, IpError> { - self.lookup_batch_internal(ips, batch_config, BASE_URL).await + self.lookup_batch_internal(ips, batch_config, BASE_URL) + .await } pub async fn lookup_batch_v6( @@ -190,7 +191,8 @@ impl IpInfo { ips: &[&str], batch_config: BatchReqOpts, ) -> Result, IpError> { - self.lookup_batch_internal(ips, batch_config, BASE_URL_V6).await + self.lookup_batch_internal(ips, batch_config, BASE_URL_V6) + .await } async fn lookup_batch_internal( @@ -201,8 +203,11 @@ impl IpInfo { ) -> Result, IpError> { // Handle the total timeout condition if let Some(total_timeout) = batch_config.timeout_total { - match timeout(total_timeout, self._lookup_batch(ips, batch_config, base_url)) - .await + match timeout( + total_timeout, + self._lookup_batch(ips, batch_config, base_url), + ) + .await { Ok(result) => result, Err(_) => Err(err!(TimeOutError)), @@ -217,7 +222,7 @@ impl IpInfo { &mut self, ips: &[&str], batch_config: BatchReqOpts, - base_url: &str + base_url: &str, ) -> Result, IpError> { let mut results: HashMap = HashMap::new(); @@ -251,7 +256,8 @@ impl IpInfo { // Make batched requests for batch in work.chunks(batch_config.batch_size as usize) { - let response = self.batch_request(client.clone(), batch, base_url).await?; + let response = + self.batch_request(client.clone(), batch, base_url).await?; results.extend(response); } @@ -275,7 +281,7 @@ impl IpInfo { &self, client: reqwest::Client, ips: &[&str], - base_url: &str + base_url: &str, ) -> Result, IpError> { // Lookup cache misses which are not bogon let response = client @@ -329,7 +335,11 @@ impl IpInfo { self.lookup_internal(ip, BASE_URL_V6).await } - async fn lookup_internal(&mut self, ip: &str, base_url: &str) -> Result { + async fn lookup_internal( + &mut self, + ip: &str, + base_url: &str, + ) -> Result { if is_bogon(ip) { return Ok(IpDetails { ip: ip.to_string(), @@ -400,7 +410,11 @@ impl IpInfo { self.get_map_internal(ips, BASE_URL_V6).await } - async fn get_map_internal(&self, ips: &[&str], base_url: &str) -> Result { + async fn get_map_internal( + &self, + ips: &[&str], + base_url: &str, + ) -> Result { if ips.len() > 500_000 { return Err(err!(MapLimitError)); }