mhost 0.11.3

Fast, async DNS lookup library and CLI -- modern dig/host replacement with parallel multi-server queries, DoH, DoT, subdomain discovery, and zone verification
Documentation
// Copyright 2017-2021 Lukas Pustina <lukas@pustina.de>
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according to those terms.

use std::marker::PhantomData;

use super::*;
use crate::services::server_lists::DownloadResponses;

#[derive(Debug)]
pub struct DownloadResponsesStats<'a> {
    pub nameserver_configs: usize,
    pub errors: usize,
    // This is used to please the borrow checker as we currently don't use a borrowed value with lifetime 'a
    phantom: PhantomData<&'a usize>,
}

impl<'a> Statistics<'a> for DownloadResponses {
    type StatsOut = DownloadResponsesStats<'a>;

    fn statistics(&'a self) -> Self::StatsOut {
        DownloadResponsesStats {
            nameserver_configs: self.nameserver_configs().count(),
            errors: self.err().count(),
            phantom: PhantomData,
        }
    }
}